Class: CBOR::Sequence
- Defined in:
- lib/cbor-pure.rb,
lib/cbor-diagnostic.rb
Instance Attribute Summary collapse
-
#elements ⇒ Object
Returns the value of attribute elements.
Instance Method Summary collapse
- #cbor_diagnostic(options = {}) ⇒ Object
- #to_cborseq ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Instance Attribute Details
#elements ⇒ Object
Returns the value of attribute elements
92 93 94 |
# File 'lib/cbor-pure.rb', line 92 def elements @elements end |
Instance Method Details
#cbor_diagnostic(options = {}) ⇒ Object
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/cbor-diagnostic.rb', line 152 def cbor_diagnostic( = {}) if elements == [] "/ empty CBOR sequence /" else indent, _indent2, = cbor__indent_helper() pieces = elements.map{ |el| el.cbor_diagnostic() } one_line = pieces.join(", ") if !(wrap = [:wrap]) || one_line.length + indent.length < wrap # XXX one_line else "#{pieces.join(",\n#{indent}")}#{",\n" if [:terminator]}" end end end |
#to_cborseq ⇒ Object
97 98 99 |
# File 'lib/cbor-pure.rb', line 97 def to_cborseq CBOR.encode_seq(elements) end |
#to_s ⇒ Object Also known as: inspect
93 94 95 |
# File 'lib/cbor-pure.rb', line 93 def to_s elements.map(&:to_s).join(", ") end |