Module: AssetLibrary::Util

Defined in:
lib/asset_library/util.rb

Class Method Summary collapse

Class Method Details

.normalize_flags(flags) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/asset_library/util.rb', line 14

def normalize_flags(flags)
  case flags
  when String
    Shellwords.shellwords(flags)
  when nil
    []
  else
    flags
  end
end

.symbolize_hash_keys(hash) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/asset_library/util.rb', line 6

def symbolize_hash_keys(hash)
  return hash unless Hash === hash # because we recurse
  hash.inject({}) do |ret, (key, value)|
    ret[(key.to_sym rescue key) || key] = symbolize_hash_keys(value)
    ret
  end
end