Class: TaliaCore::DummyHandler
- Inherits:
-
Object
- Object
- TaliaCore::DummyHandler
- Defined in:
- lib/talia_core/dummy_handler.rb
Overview
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 is the “dummy handler”
Instance Method Summary collapse
-
#initialize(namespace, subject) ⇒ DummyHandler
constructor
Create the new handler.
-
#method_missing(method, *args) ⇒ Object
Catch the invocations.
Constructor Details
#initialize(namespace, subject) ⇒ DummyHandler
Create the new handler
16 17 18 19 20 21 22 |
# File 'lib/talia_core/dummy_handler.rb', line 16 def initialize(namespace, subject) assit_kind_of(N::URI, namespace) assit_kind_of(TaliaCore::Source, subject) @namespace = namespace.to_s @subject = subject end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
Catch the invocations
25 26 27 28 29 |
# File 'lib/talia_core/dummy_handler.rb', line 25 def method_missing(method, *args) # read value raise(SemanticNamingError, "Wrong number of arguments") if(args.size != 0) @subject[@namespace + method.to_s] end |