Class: EPUB::CFI::TextLocationAssertion
- Inherits:
-
Object
- Object
- EPUB::CFI::TextLocationAssertion
- Defined in:
- lib/epub/cfi.rb
Instance Attribute Summary collapse
-
#followed ⇒ Object
readonly
Returns the value of attribute followed.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#preceded ⇒ Object
readonly
Returns the value of attribute preceded.
Instance Method Summary collapse
-
#initialize(preceded = nil, followed = nil, parameters = {}) ⇒ TextLocationAssertion
constructor
A new instance of TextLocationAssertion.
- #to_s ⇒ Object
Constructor Details
#initialize(preceded = nil, followed = nil, parameters = {}) ⇒ TextLocationAssertion
Returns a new instance of TextLocationAssertion.
239 240 241 242 |
# File 'lib/epub/cfi.rb', line 239 def initialize(preceded=nil, followed=nil, parameters={}) @preceded, @followed, @parameters = preceded, followed, parameters @string_cache = nil end |
Instance Attribute Details
#followed ⇒ Object (readonly)
Returns the value of attribute followed.
237 238 239 |
# File 'lib/epub/cfi.rb', line 237 def followed @followed end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
237 238 239 |
# File 'lib/epub/cfi.rb', line 237 def parameters @parameters end |
#preceded ⇒ Object (readonly)
Returns the value of attribute preceded.
237 238 239 |
# File 'lib/epub/cfi.rb', line 237 def preceded @preceded end |
Instance Method Details
#to_s ⇒ Object
244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/epub/cfi.rb', line 244 def to_s return @string_cache if @string_cache @string_cache = '[' @string_cache << CFI.escape(preceded) if preceded @string_cache << ',' << CFI.escape(followed) if followed parameters.each_pair do |key, values| value = values.join(',') @string_cache << ";#{CFI.escape(key)}=#{CFI.escape(value)}" end @string_cache << ']' @string_cache.freeze end |