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
111 112 113 |
# File 'lib/cbor-pure.rb', line 111 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
116 117 118 |
# File 'lib/cbor-pure.rb', line 116 def to_cborseq CBOR.encode_seq(elements) end |
#to_s ⇒ Object Also known as: inspect
112 113 114 |
# File 'lib/cbor-pure.rb', line 112 def to_s elements.map(&:to_s).join(", ") end |