Class: Wrest::Components::Mutators::CamelToSnakeCase
- Defined in:
- lib/wrest/components/mutators/camel_to_snake_case.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#do_mutate(tuple) ⇒ Object
Converts the key to snake case.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Wrest::Components::Mutators::Base
Instance Method Details
#do_mutate(tuple) ⇒ Object
Converts the key to snake case
Example: Mutators::CamelToSnakeCase.new.mutate(['Spirit-Sword', 'true']) # => ['spirit_sword', 'true']
16 17 18 |
# File 'lib/wrest/components/mutators/camel_to_snake_case.rb', line 16 def do_mutate(tuple) [tuple.first.underscore, tuple.last] end |