Module: Literal
- Included in:
- Date, DateTime, FalseClass, Float, Integer, LocalizedString, String, Time, TrueClass
- Defined in:
- lib/active_rdf/objectmanager/literal.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.typed(value, type) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/active_rdf/objectmanager/literal.rb', line 21 def self.typed(value, type) case type when XSD::string String.new(value) when XSD::date DateTime.parse(value) when XSD::boolean value == 'true' or value == 1 when XSD::integer value.to_i when XSD::double value.to_f end end |
Instance Method Details
#to_ntriple ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/active_rdf/objectmanager/literal.rb', line 36 def to_ntriple if $activerdf_without_xsdtype "\"#{to_s}\"" else "\"#{to_s}\"^^#{xsd_type}" end end |