Class: GrapeOnRails::StructuralHash

Inherits:
OpenStruct
  • Object
show all
Includes:
Enumerable
Defined in:
lib/grape_on_rails/structural_hash.rb

Instance Method Summary collapse

Instance Method Details

#each(*args, &block) ⇒ Object



16
17
18
# File 'lib/grape_on_rails/structural_hash.rb', line 16

def each *args, &block
  marshal_dump.each(*args, &block)
end

#from_hash(hash) ⇒ Object



6
7
8
# File 'lib/grape_on_rails/structural_hash.rb', line 6

def from_hash hash
  marshal_load __convert(hash)
end

#to_hashObject



10
11
12
13
14
# File 'lib/grape_on_rails/structural_hash.rb', line 10

def to_hash
  {}.tap do |result|
    marshal_dump.each{|k, v| result[k] = hash_value v}
  end
end