Class: Baloo::Parser

Inherits:
HTTParty::Parser
  • Object
show all
Defined in:
lib/baloo/parser.rb

Instance Method Summary collapse

Instance Method Details

#boolObject



19
20
21
# File 'lib/baloo/parser.rb', line 19

def bool
  body =~ /^true$/ ? true : false
end

#jsonObject



15
16
17
# File 'lib/baloo/parser.rb', line 15

def json
  Yajl::Parser.parse(body)
end

#parseObject



5
6
7
8
9
10
11
12
13
# File 'lib/baloo/parser.rb', line 5

def parse
  if /^true|false$/.match(body)
    bool
  elsif /^\{|\[.+\}|\]$/.match(body)
    json
  else
    body
  end
end