Sha256: 29477bc10e2e93d477058458932110f70a105bcccc403cd11dcd5786aa968a2b
Contents?: true
Size: 1022 Bytes
Versions: 17
Compression:
Stored size: 1022 Bytes
Contents
module EPUB module ContentDocument class XHTML attr_accessor :item # @return [String] Returns the content string. def read item.read end alias raw_document read # @return [true|false] Whether referenced directly from spine or not. def top_level? !! item.itemref end # @return [String] Returns the value of title element. # If none, returns empty string def title title_elem = nokogiri.search('title').first if title_elem title_elem.text else warn 'title element not found' '' end end # @return [REXML::Document] content as REXML::Document object def rexml require 'rexml/document' @rexml ||= REXML::Document.new(raw_document) end # @return [Nokogiri::XML::Document] content as Nokogiri::XML::Document object def nokogiri @nokogiri ||= Nokogiri.XML(raw_document) end end end end
Version data entries
17 entries across 17 versions & 2 rubygems