Class: Agentilda::Roster
- Inherits:
-
Object
- Object
- Agentilda::Roster
- Defined in:
- lib/agentilda/roster.rb
Overview
agentilda agents — who the specialists are and what each is offered
work from. Reading one in full is Viewer's job: the definition file is
already the whole truth, so agents describe opens it rather than
restating it.
#list returns a string and prints nothing, the same bargain Reporter makes, so the caller decides where the text goes and the table stays pipeable.
Everything here is read from the definition files. Nothing about a specialty is restated in Ruby, because a second copy of "who does what" is a copy that drifts from the frontmatter the loop actually routes on.
Constant Summary collapse
- HEADINGS =
Columns, so the header and the rows cannot drift apart.
["Agent", "Handles", "Advances to", "Model"].freeze
- READ_ONLY =
What an agent with no
advances_tois, in the one word that explains whyrunnever offers it work. "read-only"
Instance Attribute Summary collapse
- #agents ⇒ Agentilda::Agents readonly
Instance Method Summary collapse
-
#initialize(agents: Agents.new) ⇒ Roster
constructor
A new instance of Roster.
-
#list ⇒ String
One line per agent, in name order.
Constructor Details
Instance Attribute Details
#agents ⇒ Agentilda::Agents (readonly)
30 31 32 |
# File 'lib/agentilda/roster.rb', line 30 def agents @agents end |
Instance Method Details
#list ⇒ String
One line per agent, in name order.
35 36 37 38 39 40 |
# File 'lib/agentilda/roster.rb', line 35 def list all = agents.all return "No agent definitions in #{agents.dir}\n" if all.empty? [header(all), *all.map { |agent| row(agent, all) }].join("\n") + "\n" end |