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