Class: CBOR::Sequence

Inherits:
Struct
  • Object
show all
Defined in:
lib/cbor-pure.rb,
lib/cbor-diagnostic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#elementsObject

Returns the value of attribute elements

Returns:

  • (Object)

    the current value of elements



67
68
69
# File 'lib/cbor-pure.rb', line 67

def elements
  @elements
end

Instance Method Details

#cbor_diagnostic(options = {}) ⇒ Object



105
106
107
108
109
110
111
112
113
# File 'lib/cbor-diagnostic.rb', line 105

def cbor_diagnostic(options = {})
  if elements == []
    "/ empty CBOR sequence /"
  else
    elements.map{ |el|
      el.cbor_diagnostic(options)
    }.join(", ")
  end
end

#to_cborseqObject



72
73
74
# File 'lib/cbor-pure.rb', line 72

def to_cborseq
  CBOR.encode_seq(elements)
end

#to_sObject Also known as: inspect



68
69
70
# File 'lib/cbor-pure.rb', line 68

def to_s
  elements.map(&:to_s).join(", ")
end