Module: CBOR
- Defined in:
- lib/cbor-pure.rb,
lib/cbor-pretty.rb
Defined Under Namespace
Modules: CoreExt, Streaming
Classes: Break, Buffer, OutOfBytesError, Sequence, Simple, Tagged, Transform, Transform_j, Transform_jr
Constant Summary
collapse
- BREAK =
Break.new.freeze
- TAG_BIGNUM_BASE =
2
Class Method Summary
collapse
Class Method Details
.encode(d) ⇒ Object
77
78
79
|
# File 'lib/cbor-pure.rb', line 77
def self.encode(d)
Buffer.new.add(d).buffer
end
|
.encode_seq(ds) ⇒ Object
80
81
82
83
84
85
86
|
# File 'lib/cbor-pure.rb', line 80
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) ⇒ Object
25
26
27
|
# File 'lib/cbor-pretty.rb', line 25
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) ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/cbor-pretty.rb', line 29
def self.pretty_seq(s, indent = 0, max_target = 40)
b = Buffer.new(s)
res = '' while !b.empty?
res << b.pretty_item_final(indent, max_target, true)
end
res
end
|