Sha256: 376c1e33b748dea86b5519342452062beca93e1ba2aad2cecd25f080b415eb26
Contents?: true
Size: 847 Bytes
Versions: 3
Compression:
Stored size: 847 Bytes
Contents
class FormatParser::FDXParser include FormatParser::IOUtils def information_from_io(io) return if !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 file_info = FormatParser::FileInformation.new( file_nature: :document, file_type: file_type, document_type: document_type ) end def xml_check(io) xml_check = safe_read(io, 5) xml_check == "<?xml" ? true : false 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") return :fdx, :script else return end end FormatParser.register_parser_constructor self end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
format_parser-0.1.7 | lib/parsers/fdx_parser.rb |
format_parser-0.1.6 | lib/parsers/fdx_parser.rb |
format_parser-0.1.5 | lib/parsers/fdx_parser.rb |