Module: Darthjee::CoreExt::Symbol

Included in:
Symbol
Defined in:
lib/darthjee/core_ext/symbol.rb

Overview

Author:

  • darthjee

Instance Method Summary collapse

Instance Method Details

#camelize(first_letter = :upper) ⇒ ::Symbol

Creates new symbol camelized

Examples:

:the_symbol.camelize # returns :TheSymbol

Parameters:

  • first_letter (::Symbol) (defaults to: :upper)

    type of first letter

Returns:



17
18
19
# File 'lib/darthjee/core_ext/symbol.rb', line 17

def camelize(first_letter = :upper)
  to_s.camelize(first_letter).to_sym
end

#underscore::Symbol

The reverse of #camelize

Makes an underscored, lowercase form from the expression in the Symbol

Examples:

:theSymbol.camelize # returns :the_symbol

Returns:



30
31
32
# File 'lib/darthjee/core_ext/symbol.rb', line 30

def underscore
  to_s.underscore.to_sym
end