class Sparrow::Strategies::KeyTransformation::UnderscoreKey
Strategy class for snake_casing keys
Public Class Methods
new(*_args)
click to toggle source
Create a new UnderscoreKey
Strategy Does nothing except returning a plain instance.
# File lib/sparrow/strategies/key_transformation/underscore_key.rb, line 10 def initialize(*_args) # no initialization needed end
Public Instance Methods
transform_key(key)
click to toggle source
Transforms the given key to snake_case format @param [String] key the key to be transformed @return [String] the snake_cased key
# File lib/sparrow/strategies/key_transformation/underscore_key.rb, line 18 def transform_key(key) key.to_s.underscore end