Class: Symbol

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

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object

Method for comparison between symbols.



15
16
17
# File 'lib/git/lighttp/extensions.rb', line 15

def <=>(other)
  to_s <=> other.to_s
end

#to_const_nameObject

Parse the symbol name to constant name. Example:

$ :http_backend.to_const_name
=> 'HttpBackend'


23
24
25
26
# File 'lib/git/lighttp/extensions.rb', line 23

def to_const_name
  n = to_s.split(/_/).map(&:capitalize).join
  RUBY_VERSION =~ /1\.8/ ? n : n.to_sym
end