class Typhoid::ReadError

Attributes

body[R]

Public Class Methods

new(body) click to toggle source
# File lib/typhoid/parser.rb, line 32
def initialize(body)
  @body = body
end

Public Instance Methods

to_s() click to toggle source
# File lib/typhoid/parser.rb, line 36
def to_s
  "Could not parse JSON body: #{cleaned_body}"
end

Private Instance Methods

add_dots?() click to toggle source
# File lib/typhoid/parser.rb, line 47
def add_dots?
  body.length > 10
end
cleaned_body() click to toggle source
# File lib/typhoid/parser.rb, line 40
def cleaned_body
  clean = body[0..10]
  clean = clean + "..." if add_dots?
  clean
end