Class: EpubWorm::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/epub_worm/reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:) ⇒ Reader

Returns a new instance of Reader.



7
8
9
# File 'lib/epub_worm/reader.rb', line 7

def initialize(path:)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/epub_worm/reader.rb', line 5

def path
  @path
end

Instance Method Details

#content(reference) ⇒ Object



11
12
13
# File 'lib/epub_worm/reader.rb', line 11

def content(reference)
  ::EpubWorm::Extractors::Content.extract(path, reference)
end

#coverObject



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

def cover
  manifest.find { |manifest_item| manifest_item.reference == cover_reference }
end

#cover_referenceObject



19
20
21
# File 'lib/epub_worm/reader.rb', line 19

def cover_reference
  @cover_reference ||= ::EpubWorm::Extractors::CoverReference.extract(path)
end

#manifestObject



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

def manifest
  @manifest ||= ::EpubWorm::Extractors::Manifest.extract(path)
end

#metadataObject



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

def 
   ||= ::EpubWorm::Extractors::.extract(path)
end


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

def navigation
  @navigation ||= ::EpubWorm::Extractors::Navigation.extract(path, version: version)
end

#spineObject



35
36
37
# File 'lib/epub_worm/reader.rb', line 35

def spine
  @spine ||= ::EpubWorm::Extractors::Spine.extract(path)
end

#versionObject



39
40
41
# File 'lib/epub_worm/reader.rb', line 39

def version
  @version ||= ::EpubWorm::Extractors::Version.extract(path)
end