Sha256: e482d461bb3868ee7d040e98f7c3aae3e36ad6b965172d841f7eba30fcb4e906

Contents?: true

Size: 971 Bytes

Versions: 1

Compression:

Stored size: 971 Bytes

Contents

require 'active_rdf'
require 'semantic_naming'
require 'assit'
require 'errors'

module TaliaCore
  
  # This is an internal class for "dummy handler invocations" on sources
  # The problem is that invocations like source.namespace::name are
  # evaluated to (source.namespace).name 
  # This means that source.namespace must return an object on which
  # "name" can be called with the desired effect. This  object 
  # is the "dummy handler"
  class DummyHandler
    
    # Create the new handler
    def initialize(namespace, subject)
      assit_kind_of(N::URI, namespace)
      assit_kind_of(TaliaCore::Source, subject)
      
      @namespace = namespace.to_s
      @subject = subject
    end
    
    # Catch the invocations
    def method_missing(method, *args)
      # read value
      raise(ArgumentError, "Wrong number of arguments") if(args.size != 0)
      @subject[@namespace + method.to_s]
    end
    
    # remove the type call
    private :type
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
talia_core-0.7.0 lib/talia_core/dummy_handler.rb