Class: RubyLLM::Skills::Loader
- Inherits:
-
Object
- Object
- RubyLLM::Skills::Loader
- Defined in:
- lib/ruby_llm/skills/loader.rb
Overview
Base class for skill loaders.
Loaders are responsible for discovering and loading skills from various sources:
- FilesystemLoader: loads from directory structures
- ZipLoader: loads from .zip archives
- DatabaseLoader: loads from ActiveRecord models
Direct Known Subclasses
Instance Method Summary collapse
-
#exists?(name) ⇒ Boolean
Check if a skill exists.
-
#find(name) ⇒ Skill?
Find a skill by name.
-
#get(name) ⇒ Skill
Get a skill by name, raising if not found.
-
#list ⇒ Array<Skill>
List all skills from this source.
-
#reload! ⇒ self
Reload all skills, clearing any cache.
Instance Method Details
#exists?(name) ⇒ Boolean
Check if a skill exists.
50 51 52 |
# File 'lib/ruby_llm/skills/loader.rb', line 50 def exists?(name) !find(name).nil? end |
#find(name) ⇒ Skill?
Find a skill by name.
30 31 32 |
# File 'lib/ruby_llm/skills/loader.rb', line 30 def find(name) list.find { |skill| skill.name == name } end |
#get(name) ⇒ Skill
Get a skill by name, raising if not found.
39 40 41 42 43 44 |
# File 'lib/ruby_llm/skills/loader.rb', line 39 def get(name) skill = find(name) raise NotFoundError, "Skill not found: #{name}" unless skill skill end |
#list ⇒ Array<Skill>
List all skills from this source.
22 23 24 |
# File 'lib/ruby_llm/skills/loader.rb', line 22 def list raise NotImplementedError, "#{self.class}#list must be implemented" end |
#reload! ⇒ self
Reload all skills, clearing any cache.
57 58 59 60 |
# File 'lib/ruby_llm/skills/loader.rb', line 57 def reload! @skills = nil self end |