lib/rdfa_parser/triple.rb in rdfa_parser-0.1.1 vs lib/rdfa_parser/triple.rb in rdfa_parser-0.1.2
- old
+ new
@@ -82,15 +82,17 @@
def self.coerce_object(object)
case object
when Addressable::URI
URIRef.new(object.to_s)
- when String, Integer, Float
+ when String
if object.to_s =~ /\S+\/\/\S+/ # does it smell like a URI?
URIRef.new(object.to_s)
else
- Literal.new(object, nil, nil)
+ Literal.untyped(object)
end
+ when Integer, Float
+ Literal.build_from(object)
when URIRef, BNode, Literal
object
else
raise InvalidObject, "#{object.class}: #{object.inspect} is not a valid object"
end