class EPUB::Searcher::Result::Step
Attributes
Public Class Methods
Source
# File lib/epub/searcher/result.rb, line 61 def initialize(type, index, info={}) @type, @index, @info = type, index, info end
Public Instance Methods
Source
# File lib/epub/searcher/result.rb, line 65 def ==(other) self.type == other.type and self.index == other.index and self.info == other.info end
Source
# File lib/epub/searcher/result.rb, line 71 def to_cfi case type when :element '/%d%s' % [(index + 1) * 2, id_assertion] when :text '/%d' % [(index + 1)] when :character ':%d' % [index] when :itemref '/%d%s!' % [(index + 1) * 2, id_assertion] end end
Private Instance Methods
Source
# File lib/epub/searcher/result.rb, line 86 def id_assertion info[:id] ? "[#{info[:id]}]" : nil end