Class: RDF::NsProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/lightrdf/node.rb

Instance Method Summary collapse

Constructor Details

#initialize(ns, object) ⇒ NsProxy

Returns a new instance of NsProxy.



8
9
10
11
# File 'lib/lightrdf/node.rb', line 8

def initialize ns, object
  @object = object
  @ns = ns
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/lightrdf/node.rb', line 12

def method_missing method, *args
  if method.to_s =~ /.*=\Z/
    @object["#{@ns}:#{method.to_s[0..-2]}"] = args.first
  elsif method.to_s =~ /.*\?\Z/
    @object["#{@ns}:#{method.to_s[0..-2]}"].include?(args.first)
  else
    @object["#{@ns}:#{method}"]
  end
end