Class: Epub::Container
- Inherits:
-
Object
- Object
- Epub::Container
- Defined in:
- lib/epub-reader/container.rb
Instance Attribute Summary collapse
-
#packages ⇒ Object
readonly
Returns the value of attribute packages.
Instance Method Summary collapse
-
#initialize(reader) ⇒ Container
constructor
A new instance of Container.
- #package(index = 0) ⇒ Object
- #raw ⇒ Object
Constructor Details
#initialize(reader) ⇒ Container
Returns a new instance of Container.
6 7 8 9 10 11 12 13 14 |
# File 'lib/epub-reader/container.rb', line 6 def initialize(reader) @reader = reader @container = get_container_content @xml = Nokogiri::XML(@container) @packages = [] @xml.css('container rootfiles rootfile').each do |rootfile| @packages << Package.new(rootfile, @reader.file) end end |
Instance Attribute Details
#packages ⇒ Object (readonly)
Returns the value of attribute packages.
4 5 6 |
# File 'lib/epub-reader/container.rb', line 4 def packages @packages end |
Instance Method Details
#package(index = 0) ⇒ Object
20 21 22 |
# File 'lib/epub-reader/container.rb', line 20 def package(index = 0) @packages[index] end |
#raw ⇒ Object
16 17 18 |
# File 'lib/epub-reader/container.rb', line 16 def raw @container.to_s end |