Method: RdfContext::Literal#to_native
- Defined in:
- lib/rdf_context/literal.rb
#to_native ⇒ Object
Create native representation for value
470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File 'lib/rdf_context/literal.rb', line 470 def to_native case encoding when Encoding.boolean then @contents.to_s == "true" when Encoding.double then @contents.to_s.to_f when Encoding.integer then @contents.to_s.to_i when Encoding.float then @contents.to_s.to_f when Encoding.time then Time.parse(@contents.to_s) when Encoding.datetime then DateTime.parse(@contents.to_s) when Encoding.date then Date.parse(@contents.to_s) when Encoding.duration then Duration.parse(@contents.to_s) else @contents.to_s end end |