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



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

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

Instance Attribute Details

#content_typeObject

The MIME type of the archive



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

def content_type
  @content_type
end

#entriesObject

Array of Entry structs



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

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



18
19
20
# File 'lib/archive.rb', line 18

def format
  @format
end

#intrinsicsObject

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



25
26
27
# File 'lib/archive.rb', line 25

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



13
14
15
# File 'lib/archive.rb', line 13

def nature
  @nature
end