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.



31
32
33
34
# File 'lib/active_agent/parameterized.rb', line 31

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



36
37
38
39
40
41
42
# File 'lib/active_agent/parameterized.rb', line 36

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)


44
45
46
# File 'lib/active_agent/parameterized.rb', line 44

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