RYOTU5KPUQWRDUZIX2RPIBJIGK3IFRODHH2VWW3CLBCPSAUI7LKQC
protected
class << self
def from_object(obj)
case obj
when ::Time, ::DateTime then Tagged.create_epoch_datetime(obj.to_time)
when ::BigDecimal then Tagged.create_decimal_fraction(obj)
when ::URI then Tagged.create_uri(obj)
when ::Integer then create_integer(obj)
when ::NilClass then Null.new
when ::FalseClass then False.new
when ::TrueClass then True.new
when :undefined then Undefined.new
when ::Array then Array.new(obj.map { |o| from_object(o) })
when ::Hash then Map.new(obj.to_h { |k, v| [from_object(k), from_object(v)] })
when ::String then create_string(obj)
when ::Float then create_float(obj)
else
raise 'FIXME: implement'
end
end
class << self
def from_object(obj)
case obj
when ::Time, ::DateTime then Tagged.create_epoch_datetime(obj.to_time)
when ::BigDecimal then Tagged.create_decimal_fraction(obj)
when ::URI then Tagged.create_uri(obj)
when ::Integer then create_integer(obj)
when ::NilClass then Null.new
when ::FalseClass then False.new
when ::TrueClass then True.new
when :undefined then Undefined.new
when ::Array then Array.new(obj.map { |o| from_object(o) })
when ::Hash then Map.new(obj.to_h { |k, v| [from_object(k), from_object(v)] })
when ::String then create_string(obj)
when ::Float then create_float(obj)
else
raise 'FIXME: implement'
end
end