Module: Rumonade::HashExtensions::ClassMethods

Defined in:
lib/rumonade/hash.rb

Instance Method Summary collapse

Instance Method Details

#emptyObject



12
13
14
# File 'lib/rumonade/hash.rb', line 12

def empty
  {}
end

#unit(value) ⇒ Object

Raises:

  • (ArgumentError)


7
8
9
10
# File 'lib/rumonade/hash.rb', line 7

def unit(value)
  raise ArgumentError, "argument not a 2-element Array for Hash.unit" unless (value.is_a?(Array) && value.size == 2)
  Hash[*value]
end