class Hash

Public Instance Methods

+(otherHash) click to toggle source
# File lib/core_extensions.rb, line 81
def + (otherHash)
  merge(otherHash) { |key, v1, v2| [v1,v2] }
end
consolidate(otherHash) click to toggle source
# File lib/core_extensions.rb, line 85
def consolidate(otherHash)
  (keys + otherHash.keys).map { |key| [key, [self[key], otherHash[key]]] }.to_h
end
include_hash?(other) click to toggle source
# File lib/core_extensions.rb, line 89
def include_hash?(other)
  other.all? do |other_key_value|
    any? { |own_key_value| own_key_value == other_key_value }
  end
end
symbolize_keys() click to toggle source
# File lib/core_extensions.rb, line 95
def symbolize_keys
  self.map { |k,v| [k.to_sym, v] }.to_h
end
symbolize_keys!() click to toggle source
# File lib/core_extensions.rb, line 99
def symbolize_keys!
  self.map! { |k,v| [k.to_sym, v] }.to_h
end