Module: StackMaster::Utils
Instance Method Summary collapse
- #hash_to_aws_parameters(params) ⇒ Object
- #hash_to_aws_tags(tags) ⇒ Object
- #underscore_keys_to_hyphen(hash) ⇒ Object
- #underscore_to_hyphen(string) ⇒ Object
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 () return [] if .nil? .inject([]) do |, (key, value)| << { key: key, value: value } 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 |