Module: RDF::JSON::Extensions::Literal
- Defined in:
- lib/rdf/json/extensions.rb
Overview
RDF/JSON extensions for RDF::Literal
.
Instance Method Summary collapse
-
#to_rdf_json ⇒ Hash
Returns the RDF/JSON representation of this literal.
Instance Method Details
#to_rdf_json ⇒ Hash
Returns the RDF/JSON representation of this literal.
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/rdf/json/extensions.rb', line 73 def to_rdf_json case when has_datatype? {:type => :literal, :value => value.to_s, :datatype => datatype.to_s} when has_language? {:type => :literal, :value => value.to_s, :lang => language.to_s} else {:type => :literal, :value => value.to_s} end end |