diff options
| author | KOBAYASHI Shuji <[email protected]> | 2019-11-16 19:47:31 +0900 |
|---|---|---|
| committer | KOBAYASHI Shuji <[email protected]> | 2019-11-16 19:47:31 +0900 |
| commit | a367373fe3e9fd405bb11b0eafb7b74865d884ad (patch) | |
| tree | 7219d083433a70609aec871de1a0f247d2c4e448 /mrbgems | |
| parent | c9f156ef0c3f6992fa55798a6cbe46e4c94fc23b (diff) | |
| download | mruby-a367373fe3e9fd405bb11b0eafb7b74865d884ad.tar.gz mruby-a367373fe3e9fd405bb11b0eafb7b74865d884ad.zip | |
Revert "Implement Ruby2.7's frozen strings from `Symbol#to_s`"
This feature was reverted from Ruby 2.7.
Diffstat (limited to 'mrbgems')
| -rw-r--r-- | mrbgems/mruby-class-ext/src/class.c | 6 | ||||
| -rw-r--r-- | mrbgems/mruby-symbol-ext/mrblib/symbol.rb | 8 |
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 |
