lib/json/ld/extensions.rb in json-ld-1.0.5 vs lib/json/ld/extensions.rb in json-ld-1.0.6
- old
+ new
@@ -36,32 +36,9 @@
# Odd case of appending to a BNode identifier
def +(value)
Node.new(id + value.to_s)
end
end
-
- class Literal
- class Double
- ##
- # Converts this literal into its canonical lexical representation.
- # Update to use %.15E to avoid precision problems
- def canonicalize!
- @string = case
- when @object.nan? then 'NaN'
- when @object.infinite? then @object.to_s[0...-'inity'.length].upcase
- when @object.zero? then '0.0E0'
- else
- i, f, e = ('%.15E' % @object.to_f).split(/[\.E]/)
- f.sub!(/0*$/, '') # remove any trailing zeroes
- f = '0' if f.empty? # ...but there must be a digit to the right of the decimal point
- e.sub!(/^\+?0+(\d)$/, '\1') # remove the optional leading '+' sign and any extra leading zeroes
- "#{i}.#{f}E#{e}"
- end
- @object = Float(@string) unless @object.nil?
- self
- end
- end
- end
end
class Array
# Sort values, but impose special keyword ordering
# @yield a, b
\ No newline at end of file