Sha256: 795e0e5a69bb8385bfedc98cfd02f1adc9ffe49e7a1557803a8a0ecf6fc50a9a
Contents?: true
Size: 841 Bytes
Versions: 20
Compression:
Stored size: 841 Bytes
Contents
class FormatParser::FDXParser include FormatParser::IOUtils def likely_match?(filename) filename =~ /\.fdx$/i end def call(io) return unless xml_check(io) file_and_document_type = safe_read(io, 100) file_type, document_type = check_for_document_type(file_and_document_type) return if file_type != :fdx FormatParser::Document.new( format: file_type, document_type: document_type ) end def xml_check(io) xml_check = safe_read(io, 5) xml_check == '<?xml' end def check_for_document_type(file_and_document_type) sanitized_data = file_and_document_type.downcase if sanitized_data.include?('finaldraft') && sanitized_data.include?('script') [:fdx, :script] else nil end end FormatParser.register_parser new, natures: :document, formats: :fdx end
Version data entries
20 entries across 20 versions & 1 rubygems