Module: StackMaster::Utils

Extended by:
Utils
Included in:
Utils
Defined in:
lib/stack_master/utils.rb

Instance Method Summary collapse

Instance Method Details

#hash_to_aws_parameters(params) ⇒ Object



5
6
7
8
9
10
# File 'lib/stack_master/utils.rb', line 5

def hash_to_aws_parameters(params)
  params.inject([]) do |params, (key, value)|
    params << { parameter_key: key, parameter_value: value }
    params
  end
end

#hash_to_aws_tags(tags) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/stack_master/utils.rb', line 12

def hash_to_aws_tags(tags)
  return [] if tags.nil?
  tags.inject([]) do |aws_tags, (key, value)|
    aws_tags << { key: key, value: value }
    aws_tags
  end
end

#underscore_keys_to_hyphen(hash) ⇒ Object



24
25
26
27
28
29
# File 'lib/stack_master/utils.rb', line 24

def underscore_keys_to_hyphen(hash)
  hash.inject({}) do |hash, (key, value)|
    hash[underscore_to_hyphen(key)] = value
    hash
  end
end

#underscore_to_hyphen(string) ⇒ Object



20
21
22
# File 'lib/stack_master/utils.rb', line 20

def underscore_to_hyphen(string)
  string.to_s.gsub('_', '-')
end