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.



174
175
176
# File 'lib/structured_reader.rb', line 174

def initialize(**_)

end

Instance Method Details

#maybe_parse(fragment, _context) ⇒ Object



186
187
188
# File 'lib/structured_reader.rb', line 186

def maybe_parse(fragment, _context)
  fragment
end

#read(fragment, context) ⇒ Object



178
179
180
181
182
183
184
# File 'lib/structured_reader.rb', line 178

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