Module: CBOR::Packed::Array_Packed_CBOR

Defined in:
lib/cbor-packed.rb

Instance Method Summary collapse

Instance Method Details

#cbor_visit(&b) ⇒ Object



426
427
428
429
430
431
432
# File 'lib/cbor-packed.rb', line 426

def cbor_visit(&b)
  if yield self
    each do |o|
      o.cbor_visit(&b)
    end
  end
end

#packed_merge(other, unpacker) ⇒ Object



444
445
446
447
# File 'lib/cbor-packed.rb', line 444

def packed_merge(other, unpacker)
  # TODO: add checks
  to_unpacked_cbor1(unpacker) + other.to_unpacked_cbor1(unpacker)
end

#to_packed_cbor1(packer = Packer.from_item(self)) ⇒ Object



436
437
438
439
440
441
442
443
# File 'lib/cbor-packed.rb', line 436

def to_packed_cbor1(packer = Packer.from_item(self))
  if c = packer.has(self)
    c.to_packed_cbor1(packer)
  else
    # TODO: Find useful prefixes
    map {|x| x.to_packed_cbor1(packer)}
  end
end

#to_unpacked_cbor1(unpacker) ⇒ Object



433
434
435
# File 'lib/cbor-packed.rb', line 433

def to_unpacked_cbor1(unpacker)
  map {|x| x.to_unpacked_cbor1(unpacker)}
end