Class: Wrest::Components::Mutators::CamelToSnakeCase

Inherits:
Base
  • Object
show all
Defined in:
lib/wrest/components/mutators/camel_to_snake_case.rb

Instance Attribute Summary

Attributes inherited from Base

#next_mutator

Instance Method Summary collapse

Methods inherited from Base

#initialize, #mutate

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