summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems/mruby-symbol-ext/mrblib/symbol.rb')
-rw-r--r--mrbgems/mruby-symbol-ext/mrblib/symbol.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
index f716162e8..a4e8ef7a8 100644
--- a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
+++ b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
@@ -6,4 +6,55 @@ class Symbol
end
end
+ ##
+ # 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>.
+
+ def capitalize
+ self.to_s.capitalize.intern
+ end
+
+ ##
+ # call-seq:
+ # sym.downcase -> symbol
+ #
+ # Same as <code>sym.to_s.downcase.intern</code>.
+
+ def downcase
+ self.to_s.downcase.intern
+ end
+
+ ##
+ # call-seq:
+ # sym.upcase -> symbol
+ #
+ # Same as <code>sym.to_s.upcase.intern</code>.
+
+ def upcase
+ self.to_s.upcase.intern
+ end
+
+ #
+ # call-seq:
+ # sym.empty? -> true or false
+ #
+ # Returns that _sym_ is :"" or not.
+
+ def empty?
+ self.to_s.empty?
+ end
+
end