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

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

Overview

Converts the key to snake case

Example:

Mutators::CamelToSnakeCase.new.mutate(['Spirit-Sword', 'true'])  # => ['spirit_sword', 'true']**

Instance Attribute Summary

Attributes inherited from Base

#next_mutator

Instance Method Summary (collapse)

Methods inherited from Base

inherited, #initialize, #mutate

Constructor Details

This class inherits a constructor from Wrest::Components::Mutators::Base

Instance Method Details

- (Object) do_mutate(tuple)



17
18
19
# File 'lib/wrest/components/mutators/camel_to_snake_case.rb', line 17

def do_mutate(tuple)
  [tuple.first.underscore, tuple.last]
end