Class: Symbol

Inherits:
Object show all
Defined in:
lib/git/lighttp/extensions.rb

Instance Method Summary collapse

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_nameObject

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