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)


19
20
21
# File 'lib/epub/searcher/xhtml.rb', line 19

def initialize(element)
  @element = element
end

Class Method Details

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

Parameters:

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

Returns:



13
14
15
# File 'lib/epub/searcher/xhtml.rb', line 13

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