Class: EPUBInfo::Parser
- Inherits:
-
Object
- Object
- EPUBInfo::Parser
- Defined in:
- lib/epubinfo/parser.rb
Instance Attribute Summary (collapse)
-
- (Object) metadata_document
Returns the value of attribute metadata_document.
-
- (Object) path
Returns the value of attribute path.
Class Method Summary (collapse)
Instance Method Summary (collapse)
Instance Attribute Details
- (Object) metadata_document
Returns the value of attribute metadata_document
3 4 5 |
# File 'lib/epubinfo/parser.rb', line 3 def @metadata_document end |
- (Object) path
Returns the value of attribute path
3 4 5 |
# File 'lib/epubinfo/parser.rb', line 3 def path @path end |
Class Method Details
+ (Object) parse(path)
5 6 7 8 9 |
# File 'lib/epubinfo/parser.rb', line 5 def self.parse(path) epubinfo = EPUBInfo::Parser.new epubinfo.path = path epubinfo end |
Instance Method Details
- (Boolean) drm_protected?
15 16 17 |
# File 'lib/epubinfo/parser.rb', line 15 def drm_protected? @drm_protected ||= !!zip_file.find_entry('META-INF/rights.xml') end |
- (Object) metadata_path
27 28 29 30 31 32 |
# File 'lib/epubinfo/parser.rb', line 27 def @metadata_path ||= begin root_document.remove_namespaces! root_document.css('container rootfiles rootfile:first-child').attribute('full-path').content end end |
- (Object) zip_file
19 20 21 22 23 24 25 |
# File 'lib/epubinfo/parser.rb', line 19 def zip_file begin @zip_file ||= Zip::ZipFile.open(@path) rescue Zip::ZipError => e raise NotAnEPUBFileError.new(e) end end |