Fixing (Bool | Nil) union in the from_cbor.
parent
ac1d67d60e
commit
132368c4f1
|
@ -208,7 +208,6 @@ end
|
||||||
def Union.new(decoder : CBOR::Decoder)
|
def Union.new(decoder : CBOR::Decoder)
|
||||||
{% begin %}
|
{% begin %}
|
||||||
case decoder.current_token
|
case decoder.current_token
|
||||||
{% if T.includes? Nil || T.includes? Bool %}
|
|
||||||
when CBOR::Token::SimpleValueT
|
when CBOR::Token::SimpleValueT
|
||||||
# This value could be either a boolean or nil.
|
# This value could be either a boolean or nil.
|
||||||
value = decoder.read_simple_value
|
value = decoder.read_simple_value
|
||||||
|
@ -224,7 +223,6 @@ def Union.new(decoder : CBOR::Decoder)
|
||||||
else
|
else
|
||||||
raise "value is neither Bool or Nil"
|
raise "value is neither Bool or Nil"
|
||||||
end
|
end
|
||||||
{% end %}
|
|
||||||
{% if T.includes? String %}
|
{% if T.includes? String %}
|
||||||
when CBOR::Token::StringT
|
when CBOR::Token::StringT
|
||||||
return decoder.read_string
|
return decoder.read_string
|
||||||
|
|
Loading…
Reference in New Issue