Class: ActiveAgent::Parameterized::Agent

Inherits:
Object
  • Object
show all
Defined in:
lib/active_agent/parameterized.rb

Instance Method Summary collapse

Constructor Details

#initialize(agent, params) ⇒ Agent

Returns a new instance of Agent.



22
23
24
25
# File 'lib/active_agent/parameterized.rb', line 22

def initialize(agent, params)
  @agent = agent
  @params = params
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/active_agent/parameterized.rb', line 27

def method_missing(method_name, ...)
  if @agent.public_instance_methods.include?(method_name)
    ActiveAgent::Parameterized::Generation.new(@agent, method_name, @params, ...)
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(method, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/active_agent/parameterized.rb', line 35

def respond_to_missing?(method, include_all = false)
  @agent.respond_to?(method, include_all)
end