class EpubReader::Entry
Attributes
title[R]
Public Class Methods
new(toc_item)
click to toggle source
# File lib/epub_reader/entry.rb, line 4 def initialize toc_item unless File.exists?(toc_item.html_path) raise EpubReader::FileNotExistsException, "file #{toc_item.html_path} not exists" end @title = toc_item.title @html_path = toc_item.html_path end
Public Instance Methods
html_text()
click to toggle source
# File lib/epub_reader/entry.rb, line 13 def html_text @html_text ||= File.read(@html_path) end
images()
click to toggle source
# File lib/epub_reader/entry.rb, line 17 def images doc = Nokogiri.XML(html_text) doc.root.xpath('//xmlns:img').map do |image_element| EpubReader::Image.new(@html_path.join('..', image_element['src'])) end end