Class: EPUB::CFI::IDAssertion
- Inherits:
-
Object
- Object
- EPUB::CFI::IDAssertion
- Defined in:
- lib/epub/cfi.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
Instance Method Summary collapse
-
#initialize(id, parameters = {}) ⇒ IDAssertion
constructor
A new instance of IDAssertion.
- #to_s ⇒ Object
Constructor Details
#initialize(id, parameters = {}) ⇒ IDAssertion
Returns a new instance of IDAssertion.
218 219 220 221 |
# File 'lib/epub/cfi.rb', line 218 def initialize(id, parameters={}) @id, @parameters = id, parameters @string_cache = nil end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
216 217 218 |
# File 'lib/epub/cfi.rb', line 216 def id @id end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
216 217 218 |
# File 'lib/epub/cfi.rb', line 216 def parameters @parameters end |
Instance Method Details
#to_s ⇒ Object
223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/epub/cfi.rb', line 223 def to_s return @string_cache if @string_cache # @type ivar @string_cache: String string_cache = '[' string_cache << CFI.escape(id) if id parameters.each_pair do |key, values| value = values.join(',') string_cache << ";#{CFI.escape(key)}=#{CFI.escape(value)}" end string_cache << ']' @string_cache = string_cache end |