Class: XAeonAgents::AgentOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/x_aeon_agents/agent_options.rb

Overview

Provide agent options for different agent categories

Public API collapse

Instance Method Details

#[](agent_category) ⇒ Hash{Symbol => Object}?

Get an agent's option for a given agent category. Those options can be given directly to the agent's constructor to tune it for the desired category.

Parameters:

  • agent_category (String)

    The agent category for which we want the agent's options

Returns:

  • (Hash{Symbol => Object}, nil)

    The corresponding agent's options, or nil if none



11
12
13
14
15
# File 'lib/x_aeon_agents/agent_options.rb', line 11

def [](agent_category)
  # Lazy-evaluate it if needed
  options[agent_category] = options[agent_category].call if options[agent_category].is_a?(Proc)
  options[agent_category]
end

#[]=(agent_category, agent_options) ⇒ Object

Set an agent's option for a given agent category.

Parameters:

  • agent_category (String)

    The agent category for which we want the agent's options

  • agent_options (Hash{Symbol => Object}, #call -)

    Hash] The corresponding agent's options (can be lazily evaluated)



21
22
23
# File 'lib/x_aeon_agents/agent_options.rb', line 21

def []=(agent_category, agent_options)
  options[agent_category] = agent_options
end