Class: FormatParser::Archive

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

Defined Under Namespace

Classes: Entry

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AttributesJSON

#as_json, #to_json

Constructor Details

#initialize(**attributes) ⇒ Archive

Only permits assignments via defined accessors



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

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

Instance Attribute Details

#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