Sha256: c0f728626ca798db286ac433520dce09b03c7306e9b7c30b2aa71027bf45dfe4
Contents?: true
Size: 540 Bytes
Versions: 6
Compression:
Stored size: 540 Bytes
Contents
class FormatParser::JSONParser include FormatParser::IOUtils require_relative 'json_parser/validator' JSON_MIME_TYPE = 'application/json' def likely_match?(filename) filename =~ /\.json$/i end def call(io) io = FormatParser::IOConstraint.new(io) validator = Validator.new(io) validator.validate FormatParser::Text.new( format: :json, content_type: JSON_MIME_TYPE, ) rescue Validator::JSONParserError nil end FormatParser.register_parser new, natures: :text, formats: :json end
Version data entries
6 entries across 6 versions & 1 rubygems