Class: Hash

Inherits:
Object show all
Defined in:
lib/dorian/to_struct.rb

Instance Method Summary collapse

Instance Method Details

#to_deep_structObject



20
21
22
23
24
25
26
# File 'lib/dorian/to_struct.rb', line 20

def to_deep_struct
  Struct.new(
    *keys.map(&:to_sym)
  ).new(
    *values.map(&:to_deep_struct)
  )
end

#to_structObject



12
13
14
15
16
17
18
# File 'lib/dorian/to_struct.rb', line 12

def to_struct
  Struct.new(
    *keys.map(&:to_sym)
  ).new(
    *values
  )
end