Class: Kozo::Types::Hash

Inherits:
Kozo::Type show all
Defined in:
lib/kozo/types/hash.rb

Class Method Summary collapse

Methods inherited from Kozo::Type

lookup

Class Method Details

.cast(value) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/kozo/types/hash.rb', line 6

def self.cast(value)
  return unless value
  return value if value.is_a?(::Hash)

  value.to_h
rescue TypeError, NoMethodError => e
  raise ArgumentError, e
end