Class: StructuredReader::JSONReader::TimeReader

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

Instance Method Summary collapse

Methods inherited from StringReader

#initialize, #read

Constructor Details

This class inherits a constructor from StructuredReader::JSONReader::StringReader

Instance Method Details

#maybe_parse(fragment, context) ⇒ Object



194
195
196
197
198
199
200
# File 'lib/structured_reader.rb', line 194

def maybe_parse(fragment, context)
  begin
    context.accept DateTime.parse(fragment)
  rescue ArgumentError
    context.flunk(fragment, "could not be converted to a DateTime")
  end
end