class Yp::Response::Parser

Public Class Methods

new(params) click to toggle source
# File lib/response/parser.rb, line 5
def initialize(params)
  @params = params
end

Public Instance Methods

parse() click to toggle source
# File lib/response/parser.rb, line 9
def parse
  ruby_hash_from_response(parse_string)
end

Private Instance Methods

parse_string() click to toggle source
# File lib/response/parser.rb, line 15
def parse_string
  CGI::parse(@params)
end
ruby_hash_from_response(hash) click to toggle source
# File lib/response/parser.rb, line 19
def ruby_hash_from_response(hash)
  hash.reduce({}) do |memo, (key, value)|
    memo.merge({key.to_sym => value.first})
  end
end