Class: ActiveAgent::Parameterized::Agent Private
- Inherits:
-
Object
- Object
- ActiveAgent::Parameterized::Agent
- Defined in:
- lib/active_agent/concerns/parameterized.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Proxy class that intercepts method calls to create parameterized generations.
This class is returned by ClassMethods#with and acts as a proxy to the actual agent class, capturing method calls to actions and creating Generation instances with the stored parameters.
Instance Method Summary collapse
-
#initialize(agent, params) ⇒ Agent
constructor
private
A new instance of Agent.
-
#method_missing(method_name) ⇒ ActiveAgent::Parameterized::Generation
private
Intercepts calls to agent action methods and creates parameterized generations.
-
#respond_to_missing?(method, include_all = false) ⇒ Boolean
private
True if the agent responds to the method.
Constructor Details
#initialize(agent, params) ⇒ Agent
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Agent.
113 114 115 116 |
# File 'lib/active_agent/concerns/parameterized.rb', line 113 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) ⇒ ActiveAgent::Parameterized::Generation
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Intercepts calls to agent action methods and creates parameterized generations.
125 126 127 128 129 130 131 |
# File 'lib/active_agent/concerns/parameterized.rb', line 125 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
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns true if the agent responds to the method.
136 137 138 |
# File 'lib/active_agent/concerns/parameterized.rb', line 136 def respond_to_missing?(method, include_all = false) @agent.respond_to?(method, include_all) end |