Method: RDF::NodeProxy#initialize

Defined in:
lib/lightrdf/node_proxy.rb

#initialize(arg = nil) ⇒ Object

Constructor that allows



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/lightrdf/node_proxy.rb', line 23

def initialize arg=nil
  @node = if arg.is_a?(RDF::Node)
    arg
  elsif arg.is_a?(Hash)
    new_node = Node('*')
    new_node.rdf::type = rdf_type
    arg.each { |k,v| new_node[k] = (new_node[k] + [v].flatten).uniq }
    new_node
  else
    new_node = Node('*')
    new_node.rdf::type = rdf_type
    new_node
  end
end