Class: Ask::Skills::Registry
- Inherits:
-
Object
- Object
- Ask::Skills::Registry
- Defined in:
- lib/ask/skills/registry.rb
Instance Attribute Summary collapse
-
#skills ⇒ Object
readonly
Returns the value of attribute skills.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #format_for_prompt ⇒ Object
-
#initialize(sources) ⇒ Registry
constructor
A new instance of Registry.
- #names ⇒ Object
Constructor Details
#initialize(sources) ⇒ Registry
Returns a new instance of Registry.
6 7 8 9 10 |
# File 'lib/ask/skills/registry.rb', line 6 def initialize(sources) @skills = {} @sources = sources load_all end |
Instance Attribute Details
#skills ⇒ Object (readonly)
Returns the value of attribute skills.
4 5 6 |
# File 'lib/ask/skills/registry.rb', line 4 def skills @skills end |
Instance Method Details
#[](name) ⇒ Object
12 13 14 |
# File 'lib/ask/skills/registry.rb', line 12 def [](name) @skills[name] end |
#format_for_prompt ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/ask/skills/registry.rb', line 20 def format_for_prompt return "" if @skills.empty? lines = ["", "## Available Skills", ""] @skills.each_value do |skill| lines << skill.to_prompt_entry end lines << "" lines.join("\n") end |
#names ⇒ Object
16 17 18 |
# File 'lib/ask/skills/registry.rb', line 16 def names @skills.keys end |