Class: Bristow::Agency
- Inherits:
-
Object
show all
- Includes:
- Sgetter
- Defined in:
- lib/bristow/agency.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Sgetter
included
Constructor Details
#initialize(agents: self.class.agents.dup) ⇒ Agency
Returns a new instance of Agency.
7
8
9
|
# File 'lib/bristow/agency.rb', line 7
def initialize(agents: self.class.agents.dup)
@agents = agents
end
|
Class Method Details
.chat ⇒ Object
11
12
13
|
# File 'lib/bristow/agency.rb', line 11
def self.chat(...)
new.chat(...)
end
|
Instance Method Details
#chat(messages, &block) ⇒ Object
15
16
17
|
# File 'lib/bristow/agency.rb', line 15
def chat(messages, &block)
raise NotImplementedError, "#{self.class.name}#chat must be implemented"
end
|
#find_agent(name) ⇒ Object
19
20
21
22
23
24
|
# File 'lib/bristow/agency.rb', line 19
def find_agent(name)
agent = agents.find { |agent| agent_name_for(agent) == name }
return nil unless agent
agent.is_a?(Class) ? agent.new : agent
end
|