class Typhoid::Parser

Attributes

json_string[R]

Public Class Methods

call(json_string) click to toggle source
# File lib/typhoid/parser.rb, line 5
def self.call(json_string)
  new(json_string).parse
end
new(json_string) click to toggle source
# File lib/typhoid/parser.rb, line 9
def initialize(json_string)
  @json_string = json_string
end

Public Instance Methods

parse() click to toggle source
# File lib/typhoid/parser.rb, line 13
def parse
  parsed_body if json_string.present?
end

Private Instance Methods

engine() click to toggle source
# File lib/typhoid/parser.rb, line 24
def engine
  JSON.method(:parse)
end
parsed_body() click to toggle source
# File lib/typhoid/parser.rb, line 17
def parsed_body
  engine.call json_string
rescue
  raise ReadError, json_string
end