module CBOR
Constants
- BREAK
- Sequence
- Simple
- TAG_BIGNUM_BASE
- Tagged
Public Class Methods
decode(s)
click to toggle source
# File lib/cbor-pure.rb, line 86 def self.decode(s) Buffer.new(s).decode_item_final end
decode_seq(s)
click to toggle source
# File lib/cbor-pure.rb, line 92 def self.decode_seq(s) Buffer.new(s).decode_items end
decode_with_rest(s)
click to toggle source
# File lib/cbor-pure.rb, line 89 def self.decode_with_rest(s) Buffer.new(s).decode_item_with_rest end
encode(d)
click to toggle source
# File lib/cbor-pure.rb, line 76 def self.encode(d) Buffer.new.add(d).buffer end
encode_seq(ds)
click to toggle source
# File lib/cbor-pure.rb, line 79 def self.encode_seq(ds) out = Buffer.new ds.each do |d| out.add(d) end out.buffer end
pretty(s, indent = 0, max_target = 40)
click to toggle source
# File lib/cbor-pretty.rb, line 15 def self.pretty(s, indent = 0, max_target = 40) Buffer.new(s).pretty_item_final(indent, max_target) end
pretty_seq(s, indent = 0, max_target = 40)
click to toggle source
# File lib/cbor-pretty.rb, line 19 def self.pretty_seq(s, indent = 0, max_target = 40) b = Buffer.new(s) res = '' # XXX: not all indented the same while !b.empty? res << b.pretty_item_final(indent, max_target, true) end res end