module StackMaster::Utils

Public Instance Methods

change_extension(file_name, extension) click to toggle source
# File lib/stack_master/utils.rb, line 17
def change_extension(file_name, extension)
  [
    File.basename(file_name, '.*'),
    extension
  ].join('.')
end
hash_to_aws_parameters(params) click to toggle source
# File lib/stack_master/utils.rb, line 24
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) click to toggle source
# File lib/stack_master/utils.rb, line 31
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) click to toggle source
# File lib/stack_master/utils.rb, line 43
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) click to toggle source
# File lib/stack_master/utils.rb, line 39
def underscore_to_hyphen(string)
  string.to_s.gsub('_', '-')
end