summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-symbol-ext/mrblib
diff options
context:
space:
mode:
authortake_cheeze <[email protected]>2014-06-20 21:56:03 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-06-23 19:51:27 +0900
commit7015493efbc2efe6820d65eabad387f3fea4a414 (patch)
treea75f6669a2624083c535ce549eca4403429b6409 /mrbgems/mruby-symbol-ext/mrblib
parent0a6b54acd63f0f396eda6e1e5e2366ce91a35d79 (diff)
downloadmruby-7015493efbc2efe6820d65eabad387f3fea4a414.tar.gz
mruby-7015493efbc2efe6820d65eabad387f3fea4a414.zip
Reduce string creation of `length`, `size`, `empty?` method of `Symbol` extension.
Diffstat (limited to 'mrbgems/mruby-symbol-ext/mrblib')
-rw-r--r--mrbgems/mruby-symbol-ext/mrblib/symbol.rb13
1 files changed, 1 insertions, 12 deletions
diff --git a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
index b2615a760..1e249c281 100644
--- a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
+++ b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
@@ -9,17 +9,6 @@ class Symbol
##
# call-seq:
- # sym.length -> integer
- #
- # Same as <code>sym.to_s.length</code>.
-
- def length
- self.to_s.length
- end
- alias :size :length
-
- ##
- # call-seq:
# sym.capitalize -> symbol
#
# Same as <code>sym.to_s.capitalize.intern</code>.
@@ -66,7 +55,7 @@ class Symbol
# Returns that _sym_ is :"" or not.
def empty?
- self.to_s.empty?
+ self.length == 0
end
end