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_s ⇒ Object
Constructor Details
#initialize(type, index, info = {}) ⇒ Step
Returns a new instance of Step.
73 74 75 |
# File 'lib/epub/searcher/result.rb', line 73 def initialize(type, index, info={}) @type, @index, @info = type, index, info end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
71 72 73 |
# File 'lib/epub/searcher/result.rb', line 71 def index @index end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
71 72 73 |
# File 'lib/epub/searcher/result.rb', line 71 def info @info end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
71 72 73 |
# File 'lib/epub/searcher/result.rb', line 71 def type @type end |
Instance Method Details
#==(other) ⇒ Object
77 78 79 80 81 |
# File 'lib/epub/searcher/result.rb', line 77 def ==(other) self.type == other.type and self.index == other.index and self.info == other.info end |
#to_cfi_s ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/epub/searcher/result.rb', line 83 def to_cfi_s 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 |