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.
264 265 266 267 |
# File 'lib/epub/cfi.rb', line 264 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.
261 262 263 |
# File 'lib/epub/cfi.rb', line 261 def assertion @assertion end |
#value ⇒ Object (readonly) Also known as: offset
Returns the value of attribute value.
261 262 263 |
# File 'lib/epub/cfi.rb', line 261 def value @value end |
Instance Method Details
#<=>(other) ⇒ Object
273 274 275 |
# File 'lib/epub/cfi.rb', line 273 def <=>(other) value <=> other.value end |
#to_s ⇒ Object
269 270 271 |
# File 'lib/epub/cfi.rb', line 269 def to_s @string_cache ||= ":#{value}#{assertion}" # need escape? end |