Module: Hadley::Utils
Overview
This module contains a collection of generally useful methods that (currently) have no better place to live. They can either be referenced directly as module methods or be mixed in.
Instance Method Summary collapse
-
#camelize(name, uc_first = true) ⇒ String
This method will derive a camelized name from the provided underscored name.
Instance Method Details
#camelize(name, uc_first = true) ⇒ String
This method will derive a camelized name from the provided underscored name.
13 14 15 16 17 |
# File 'lib/hadley/utils.rb', line 13 def camelize(name, uc_first=true) parts = name.to_s.split('_') assemble = lambda { |head, tail| head + tail.capitalize } uc_first ? parts.inject('', &assemble) : parts.inject(&assemble) end |