Class: EPUB::Searcher::Result::Step
- Inherits:
-
Object
- Object
- EPUB::Searcher::Result::Step
- Defined in:
- lib/epub/searcher/result.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(type, index, info = {}) ⇒ Step
constructor
A new instance of Step.
- #to_cfi ⇒ Object
Constructor Details
#initialize(type, index, info = {}) ⇒ Step
Returns a new instance of Step.
61 62 63 |
# File 'lib/epub/searcher/result.rb', line 61 def initialize(type, index, info={}) @type, @index, @info = type, index, info end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
59 60 61 |
# File 'lib/epub/searcher/result.rb', line 59 def index @index end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
59 60 61 |
# File 'lib/epub/searcher/result.rb', line 59 def info @info end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
59 60 61 |
# File 'lib/epub/searcher/result.rb', line 59 def type @type end |
Instance Method Details
#==(other) ⇒ Object
[View source]
65 66 67 68 69 |
# 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 |
#to_cfi ⇒ Object
[View source]
71 72 73 74 75 76 77 78 79 80 81 82 |
# 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 |