Module: Intrinsic::Intrinsicism::Coercion::Hash

Defined in:
lib/intrinsic/intrinsicism/coercion/hash.rb

Class Method Summary collapse

Class Method Details

.convert(value) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/intrinsic/intrinsicism/coercion/hash.rb', line 5

def self.convert(value)
  case value
    when Hash then value
    when Array then Hash[*value.flatten]
    when Integer then raise TypeError
    when String then raise TypeError
  end
end