Write JSON::Any
parent
b0c62f89c8
commit
3c82ed329f
|
@ -1,3 +1,5 @@
|
||||||
|
require "json"
|
||||||
|
|
||||||
class CBOR::Encoder
|
class CBOR::Encoder
|
||||||
def self.new(io : IO = IO::Memory.new)
|
def self.new(io : IO = IO::Memory.new)
|
||||||
packer = new(io)
|
packer = new(io)
|
||||||
|
@ -8,6 +10,10 @@ class CBOR::Encoder
|
||||||
def initialize(@io : IO = IO::Memory.new)
|
def initialize(@io : IO = IO::Memory.new)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def write(j : JSON::Any)
|
||||||
|
write j.raw
|
||||||
|
end
|
||||||
|
|
||||||
def write(value : Nil | Nil.class, use_undefined : Bool = false)
|
def write(value : Nil | Nil.class, use_undefined : Bool = false)
|
||||||
write(use_undefined ? SimpleValue::Undefined : SimpleValue::Null)
|
write(use_undefined ? SimpleValue::Undefined : SimpleValue::Null)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue