Class: EPUB::CFI::CharacterOffset
- Inherits:
-
Object
- Object
- EPUB::CFI::CharacterOffset
- Defined in:
- lib/epub/cfi.rb
Instance Attribute Summary collapse
-
#assertion ⇒ Object
readonly
Returns the value of attribute assertion.
-
#value ⇒ Object
(also: #offset)
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(value, assertion = nil) ⇒ CharacterOffset
constructor
A new instance of CharacterOffset.
- #to_s ⇒ Object
Constructor Details
#initialize(value, assertion = nil) ⇒ CharacterOffset
Returns a new instance of CharacterOffset.
255 256 257 258 |
# File 'lib/epub/cfi.rb', line 255 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.
252 253 254 |
# File 'lib/epub/cfi.rb', line 252 def assertion @assertion end |
#value ⇒ Object (readonly) Also known as: offset
Returns the value of attribute value.
252 253 254 |
# File 'lib/epub/cfi.rb', line 252 def value @value end |
Instance Method Details
#<=>(other) ⇒ Object
264 265 266 |
# File 'lib/epub/cfi.rb', line 264 def <=>(other) value <=> other.value end |
#to_s ⇒ Object
260 261 262 |
# File 'lib/epub/cfi.rb', line 260 def to_s @string_cache ||= ":#{value}#{assertion}" # need escape? end |