Class: StructuredReader::JSONReader::StringReader

Inherits:
Object
  • Object
show all
Defined in:
lib/structured_reader.rb

Direct Known Subclasses

TimeReader

Instance Method Summary collapse

Constructor Details

#initialize(**_) ⇒ StringReader

Returns a new instance of StringReader.



180
181
182
# File 'lib/structured_reader.rb', line 180

def initialize(**_)

end

Instance Method Details

#maybe_parse(fragment, _context) ⇒ Object



192
193
194
# File 'lib/structured_reader.rb', line 192

def maybe_parse(fragment, _context)
  fragment
end

#read(fragment, context) ⇒ Object



184
185
186
187
188
189
190
# File 'lib/structured_reader.rb', line 184

def read(fragment, context)
  if fragment.kind_of?(String)
    context.accept maybe_parse(fragment, context)
  else
    context.flunk(fragment, "expected a String")
  end
end