Class: A9n::Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/a9n/ext/hash.rb

Class Method Summary collapse

Class Method Details

.deep_prepare(hash, scope) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/a9n/ext/hash.rb', line 4

def deep_prepare(hash, scope)
  hash.inject({}) do |result, (key, value)|
    key_name = key.respond_to?(:to_sym) ? key.to_sym : key
    result[key_name] = get_value(key, value, scope)
    result
  end
end

.merge(*items) ⇒ Object



12
13
14
15
16
# File 'lib/a9n/ext/hash.rb', line 12

def merge(*items)
  return nil if items.compact.empty?

  items.compact.inject({}) { |sum, item| sum.merge!(item) }
end