Module: SmartConfig::Formatters

Defined in:
lib/smart_config/formatters.rb,
lib/smart_config/formatters/float.rb,
lib/smart_config/formatters/string.rb,
lib/smart_config/formatters/boolean.rb,
lib/smart_config/formatters/integer.rb

Overview

Formatters define behaviors to format values into another type This is especially useful for environment variables, which are always strings

Defined Under Namespace

Classes: Boolean, Float, Integer, String

Class Method Summary collapse

Class Method Details

.camelize(format) ⇒ Object



13
14
15
# File 'lib/smart_config/formatters.rb', line 13

def self.camelize(format)
  format.to_s.split('_').collect(&:capitalize).join
end

.find(format) ⇒ Object



9
10
11
# File 'lib/smart_config/formatters.rb', line 9

def self.find(format)
  SmartConfig::Formatters.const_get(camelize(format))
end