Module: Redlander
- Defined in:
- lib/redlander.rb,
lib/redlander/uri.rb,
lib/redlander/node.rb,
lib/redlander/model.rb,
lib/redlander/parsing.rb,
lib/redlander/version.rb,
lib/redlander/statement.rb,
lib/redlander/model_proxy.rb,
lib/redlander/serializing.rb,
lib/redlander/query/results.rb
Overview
Main Redlander namespace
Defined Under Namespace
Modules: Parsing, Query, Serializing Classes: Model, ModelProxy, Node, Statement, Uri
Constant Summary collapse
- VERSION =
Redlander version number
"0.6.2"
Class Method Summary collapse
- .rdf_world ⇒ Object private
-
.to_rdf_options(options = {}) ⇒ Object
private
Convert options hash into a string for librdf.
Class Method Details
.rdf_world ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 20 21 22 23 24 25 |
# File 'lib/redlander.rb', line 17 def rdf_world unless @rdf_world @rdf_world = Redland.librdf_new_world raise RedlandError, "Could not create a new RDF world" if @rdf_world.null? ObjectSpace.define_finalizer(self, finalize_world(@rdf_world)) Redland.librdf_world_open(@rdf_world) end @rdf_world end |
.to_rdf_options(options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert options hash into a string for librdf. What it does:
1) Convert boolean values into 'yes/no' values
2) Change underscores in key names into dashes ('dhar_ma' => 'dhar-ma')
3) Join all options as "key='value'" pairs in a comma-separated string
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/redlander.rb', line 38 def ( = {}) .inject([]){|opts, option_pair| key = option_pair[0].to_s.gsub(/_/, '-') value = if [TrueClass, FalseClass].include?(option_pair[1].class) option_pair[1] ? 'yes' : 'no' else option_pair[1] end opts << "#{key}='#{value}'" }.join(',') end |