class RDF::URI
Public Class Methods
cache()
click to toggle source
@return [RDF::Util::Cache] @private
# File lib/rdf/rdfobjects/uri.rb, line 6 def self.cache require 'rdf/util/cache' unless defined?(::RDF::Util::Cache) @cache ||= {} @cache[@graph] ||= RDF::Util::Cache.new(CACHE_SIZE) end
intern(str)
click to toggle source
Don’t freeze the URIs. Keep an eye on this, since, presumably, URIs are being frozen for a reason. However, we cannot add graphs to frozen objects and the ObjectStore complicates things.
# File lib/rdf/rdfobjects.rb, line 16 def self.intern(str) (cache[str = str.to_s] ||= self.new(str)) end
Public Instance Methods
graph=(graph)
click to toggle source
# File lib/rdf/rdfobjects/uri.rb, line 16 def graph=(graph) raise ArgumentError unless graph.is_a?(::RDF::Graph) if !self.frozen? && graph != self.graph @graph = graph elsif self.frozen? && graph != self.graph new_uri = self.dup self = new_uri @graph = graph end end