Module: JIJI::Agent::Shared

Defined in:
lib/jiji/agent/agent.rb

Overview

:nodoc:

Constant Summary collapse

@@deleates =
{}

Class Method Summary collapse

Class Method Details

._delegatesObject



40
41
42
# File 'lib/jiji/agent/agent.rb', line 40

def self._delegates
  @@deleates
end

.const_missing(id) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/jiji/agent/agent.rb', line 18

def self.const_missing(id)
  super unless @@deleates
  result = nil
  @@deleates.each_pair{|k,v|
    if v.const_defined?(id)
      result = v.const_get(id)
      break
    end
  }
  result ? result : super
end

.method_missing(name, *args, &block) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/jiji/agent/agent.rb', line 29

def self.method_missing(name,*args, &block)
  super unless @@deleates
  target = nil
  @@deleates.each_pair{|k,v|
    if v.respond_to?(name)
      target = v
      break
    end
  }
  target ? target.send( name, *args, &block ) : super
end