Class: WellRested::CamelCaseFormatter
- Inherits:
-
Object
- Object
- WellRested::CamelCaseFormatter
- Defined in:
- lib/well_rested/camel_case_formatter.rb
Instance Method Summary collapse
- #decode(hash) ⇒ Object
- #encode(hash) ⇒ Object
-
#initialize(lower = true) ⇒ CamelCaseFormatter
constructor
A new instance of CamelCaseFormatter.
Constructor Details
#initialize(lower = true) ⇒ CamelCaseFormatter
Returns a new instance of CamelCaseFormatter.
3 4 5 |
# File 'lib/well_rested/camel_case_formatter.rb', line 3 def initialize(lower = true) raise "Upper case camelizing not supported yet" unless lower # TODO: Support upper-camel-casing end |
Instance Method Details
#decode(hash) ⇒ Object
11 12 13 |
# File 'lib/well_rested/camel_case_formatter.rb', line 11 def decode(hash) KeyTransformer.underscore_keys(hash) end |
#encode(hash) ⇒ Object
7 8 9 |
# File 'lib/well_rested/camel_case_formatter.rb', line 7 def encode(hash) KeyTransformer.camelize_keys(hash) end |