Class: EPUB::CFI::Step
- Inherits:
-
Object
- Object
- EPUB::CFI::Step
- Defined in:
- lib/epub/cfi.rb
Instance Attribute Summary collapse
-
#assertion ⇒ Object
readonly
Returns the value of attribute assertion.
-
#value ⇒ Object
(also: #step)
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #character_data? ⇒ Boolean
- #element? ⇒ Boolean
-
#initialize(value, assertion = nil) ⇒ Step
constructor
A new instance of Step.
- #initialize_copy(original) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value, assertion = nil) ⇒ Step
Returns a new instance of Step.
188 189 190 191 |
# File 'lib/epub/cfi.rb', line 188 def initialize(value, assertion=nil) @value, @assertion = value, assertion @string_cache = nil end |
Instance Attribute Details
#assertion ⇒ Object (readonly)
Returns the value of attribute assertion.
185 186 187 |
# File 'lib/epub/cfi.rb', line 185 def assertion @assertion end |
#value ⇒ Object (readonly) Also known as: step
Returns the value of attribute value.
185 186 187 |
# File 'lib/epub/cfi.rb', line 185 def value @value end |
Instance Method Details
#<=>(other) ⇒ Object
202 203 204 |
# File 'lib/epub/cfi.rb', line 202 def <=>(other) value <=> other.value end |
#character_data? ⇒ Boolean
210 211 212 |
# File 'lib/epub/cfi.rb', line 210 def character_data? value.odd? end |
#element? ⇒ Boolean
206 207 208 |
# File 'lib/epub/cfi.rb', line 206 def element? value.even? end |
#initialize_copy(original) ⇒ Object
193 194 195 196 |
# File 'lib/epub/cfi.rb', line 193 def initialize_copy(original) @value = original.value @assertion = original.assertion.dup if original.assertion end |
#to_s ⇒ Object
198 199 200 |
# File 'lib/epub/cfi.rb', line 198 def to_s @string_cache ||= "/#{value}#{assertion}".freeze # need escape? end |