Class: FormatParser::Archive

Inherits:
Object
  • Object
show all
Includes:
AttributesJSON
Defined in:
lib/archive.rb

Defined Under Namespace

Classes: Entry

Constant Summary

Constants included from AttributesJSON

FormatParser::AttributesJSON::MAXIMUM_JSON_NESTING_WHEN_SANITIZING

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AttributesJSON

_sanitize_json_value, #as_json, #to_json

Constructor Details

#initialize(**attributes) ⇒ Archive

Only permits assignments via defined accessors



33
34
35
# File 'lib/archive.rb', line 33

def initialize(**attributes)
  attributes.map { |(k, v)| public_send("#{k}=", v) }
end

Instance Attribute Details

#content_typeObject

The MIME type of the archive



30
31
32
# File 'lib/archive.rb', line 30

def content_type
  @content_type
end

#entriesObject

Array of Entry structs



23
24
25
# File 'lib/archive.rb', line 23

def entries
  @entries
end

#formatObject

What filetype was recognized? Will contain a non-ambiguous symbol referring to the file format. The symbol can be used as a filename extension safely



20
21
22
# File 'lib/archive.rb', line 20

def format
  @format
end

#intrinsicsObject

If a parser wants to provide any extra information to the caller it can be placed here



27
28
29
# File 'lib/archive.rb', line 27

def intrinsics
  @intrinsics
end

#natureObject

Lots of Office and LibreOffice documents are in fact packaged into ZIPs, as are .epub files. We make ‘nature` customisable for this occasion



15
16
17
# File 'lib/archive.rb', line 15

def nature
  @nature
end