Class: Symbol
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Method for comparison between symbols.
-
#to_const_name ⇒ Object
Parse the symbol name to constant name.
Instance Method Details
#<=>(other) ⇒ Object
Method for comparison between symbols.
16 17 18 |
# File 'lib/git/lighttp/extensions.rb', line 16 def <=>(other) self.to_s <=> other.to_s end |
#to_const_name ⇒ Object
Parse the symbol name to constant name. Example:
$ :http_backend.to_const_name
=> "HttpBackend"
24 25 26 27 |
# File 'lib/git/lighttp/extensions.rb', line 24 def to_const_name n = self.to_s.split(/_/).map(&:capitalize).join RUBY_VERSION =~ /1\.8/ ? n : n.to_sym end |