Class: EPUB::Searcher::XHTML

Inherits:
Object
  • Object
show all
Defined in:
lib/epub/searcher/xhtml.rb

Direct Known Subclasses

Restricted, Seamless

Defined Under Namespace

Classes: Restricted, Seamless

Constant Summary collapse

ALGORITHMS =
{}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ XHTML

Returns a new instance of XHTML.

Parameters:

  • word (String)


21
22
23
# File 'lib/epub/searcher/xhtml.rb', line 21

def initialize(element)
  @element = element
end

Class Method Details

.search_text(element, word) ⇒ Array<Result>

Parameters:

  • element (REXML::Element, REXML::Document, Oga::XML::ELement, Oga::XML::Document, Nokogiri::XML::Element, Nokogiri::XML::Document)
  • word (String)

Returns:



15
16
17
# File 'lib/epub/searcher/xhtml.rb', line 15

def search_text(element, word)
  new(element.respond_to?(:root) ? element.root : element).search_text(word)
end