module CBOR::Packed::Tagged_Packed_CBOR
Public Instance Methods
cbor_visit() { |self| ... }
click to toggle source
# File lib/cbor-packed.rb, line 254 def cbor_visit(&b) if yield self value.cbor_visit(&b) end end
to_packed_cbor1(packer = Packer.from_item(self))
click to toggle source
# File lib/cbor-packed.rb, line 294 def to_packed_cbor1(packer = Packer.from_item(self)) if c = packer.has(self) c else CBOR::Tagged.new(tag, value.to_packed_cbor1(packer)) end end
to_unpacked_cbor()
click to toggle source
# File lib/cbor-packed.rb, line 259 def to_unpacked_cbor if tag == PACKED_TAG # check that this really is an array # warn value.to_yaml ma, pa, sa, pv = value unpacker = Unpacker.new(ma, pa, sa) pv.to_unpacked_cbor1(unpacker) else fail "error message here" end end
to_unpacked_cbor1(unpacker)
click to toggle source
# File lib/cbor-packed.rb, line 270 def to_unpacked_cbor1(unpacker) case tag when REF_TAG if Integer === value unpacker(untag(value)) else unpacker.unprefix(0).packed_merge value, unpacker end when 225...256 unpacker.unprefix(tag-(256-32)).packed_merge value, unpacker when 28704...32768 # (- 28704 (- 32768 4096)) == 32 unpacker.unprefix(tag-(32768-4096)).packed_merge value, unpacker when 1879052288...2147483648 # (- 1879052288 (- 2147483648 268435456)) == 4096 unpacker.unprefix(tag-(2147483648-268435456)).packed_merge value, unpacker when 216...224 value.packed_merge unpacker.unsuffix(tag-216), unpacker when 27647...28672 value.packed_merge unpacker.unsuffix(tag-(28672-1024)), unpacker when 1811940352...1879048192 value.packed_merge unpacker.unsuffix(tag-(1879048192-67108864)), unpacker else CBOR::Tagged.new(tag, value.to_unpacked_cbor1(unpacker)) end end