lib/rdf/model/literal/double.rb in rdf-2.1.1 vs lib/rdf/model/literal/double.rb in rdf-2.2.0.pre.rc1

- old
+ new

@@ -13,15 +13,14 @@ class Double < Numeric DATATYPE = RDF::XSD.double GRAMMAR = /^(?:NaN|(?:[\+\-]?(?:INF|(?:\d+(\.\d*)?(e[\+\-]?\d+)?))))$/i.freeze ## - # @param [Float, #to_f] value - # @option options [String] :lexical (nil) - def initialize(value, options = {}) - @datatype = RDF::URI(options[:datatype] || self.class.const_get(:DATATYPE)) - @string = options[:lexical] if options.has_key?(:lexical) - @string ||= value if value.is_a?(String) + # @param [String, Float, #to_f] value + # @param (see Literal#initialize) + def initialize(value, datatype: nil, lexical: nil, **options) + @datatype = RDF::URI(datatype || self.class.const_get(:DATATYPE)) + @string = lexical || (value if value.is_a?(String)) @object = case when value.is_a?(::String) then case value when '+INF' then 1/0.0 when 'INF' then 1/0.0 when '-INF' then -1/0.0