Module: Winker::Parser

Included in:
Winker
Defined in:
lib/winker.rb

Instance Method Summary collapse

Instance Method Details

#parse(body) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/winker.rb', line 23

def parse(body)
  case body
  when Hash
    body.each do |k,v|
      body[k] = parse(v)
    end
    OpenStruct.new(body)
  when Array
    body.map { |item| parse(item) }
  else
    body
  end
end