Module: Jackal::Cfn::Utils

Included in:
Event, Resource, Fog
Defined in:
lib/jackal-cfn/utils.rb,
lib/jackal-cfn/utils/fog.rb,
lib/jackal-cfn/utils/http.rb

Defined Under Namespace

Modules: Fog, Http

Instance Method Summary collapse

Instance Method Details

#snakecase(v) ⇒ Symbol

Snake case string

Parameters:

  • v (String)

Returns:

  • (Symbol)


27
28
29
# File 'lib/jackal-cfn/utils.rb', line 27

def snakecase(v)
  Bogo::Utility.snake(v)
end

#transform_parameters(params) ⇒ Hash Also known as: rekey_hash

Snake case top level keys in hash

Parameters:

  • params (Hash)

Returns:

  • (Hash)

    new hash with snake cased toplevel keys



14
15
16
17
18
19
20
# File 'lib/jackal-cfn/utils.rb', line 14

def transform_parameters(params)
  Smash.new.tap do |new_hash|
    (params || []).each do |key, value|
      new_hash[snakecase(key)] = value
    end
  end
end