module CBOR::Packed::Hash_Packed_CBOR

Public Instance Methods

cbor_visit() { |self| ... } click to toggle source
# File lib/cbor-packed.rb, line 227
def cbor_visit(&b)
  if yield self
    each do |k, v|
      k.cbor_visit(&b)
      v.cbor_visit(&b)
    end
  end
end
packed_merge(other, unpacker) click to toggle source
# File lib/cbor-packed.rb, line 246
def packed_merge(other, unpacker)
  # TODO: add checks
  to_unpacked_cbor1(unpacker).merge other.to_unpacked_cbor1(unpacker)
end
to_packed_cbor1(packer = Packer.from_item(self)) click to toggle source
# File lib/cbor-packed.rb, line 238
def to_packed_cbor1(packer = Packer.from_item(self))
  if c = packer.has(self)
    c.to_unpacked_cbor1(unpacker)
  else
    # TODO: Find useful prefixes
    Hash[map {|k, v| [k.to_packed_cbor1(packer), v.to_packed_cbor1(packer)]}]
  end
end
to_unpacked_cbor1(unpacker) click to toggle source
# File lib/cbor-packed.rb, line 235
def to_unpacked_cbor1(unpacker)
  Hash[map {|k, v| [k.to_unpacked_cbor1(unpacker), v.to_unpacked_cbor1(unpacker)]}]
end