summaryrefslogtreecommitdiffhomepage
path: root/mrbgems
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems')
-rw-r--r--mrbgems/mruby-class-ext/src/class.c6
-rw-r--r--mrbgems/mruby-symbol-ext/mrblib/symbol.rb8
2 files changed, 9 insertions, 5 deletions
diff --git a/mrbgems/mruby-class-ext/src/class.c b/mrbgems/mruby-class-ext/src/class.c
index 0d27c30ed..02ebf80cc 100644
--- a/mrbgems/mruby-class-ext/src/class.c
+++ b/mrbgems/mruby-class-ext/src/class.c
@@ -5,7 +5,11 @@
static mrb_value
mrb_mod_name(mrb_state *mrb, mrb_value self)
{
- return mrb_class_path(mrb, mrb_class_ptr(self));
+ mrb_value name = mrb_class_path(mrb, mrb_class_ptr(self));
+ if (mrb_string_p(name)) {
+ MRB_SET_FROZEN_FLAG(mrb_basic_ptr(name));
+ }
+ return name;
}
static mrb_value
diff --git a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
index 4b4cf83fe..99fa275d5 100644
--- a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
+++ b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
@@ -10,7 +10,7 @@ class Symbol
# Same as <code>sym.to_s.capitalize.intern</code>.
def capitalize
- self.to_s.capitalize.to_sym
+ (self.to_s.capitalize! || self).to_sym
end
##
@@ -20,7 +20,7 @@ class Symbol
# Same as <code>sym.to_s.downcase.intern</code>.
def downcase
- self.to_s.downcase.to_sym
+ (self.to_s.downcase! || self).to_sym
end
##
@@ -30,7 +30,7 @@ class Symbol
# Same as <code>sym.to_s.upcase.intern</code>.
def upcase
- self.to_s.upcase.to_sym
+ (self.to_s.upcase! || self).to_sym
end
##
@@ -41,7 +41,7 @@ class Symbol
def casecmp(other)
return nil unless other.kind_of?(Symbol)
- lhs = self.to_s.upcase
+ lhs = self.to_s; lhs.upcase!
rhs = other.to_s.upcase
lhs <=> rhs
end