Class: Riffer::Skills::Backend
- Inherits:
-
Object
- Object
- Riffer::Skills::Backend
- Defined in:
- lib/riffer/skills/backend.rb
Overview
Base class defining the interface for skill storage backends.
Subclass and implement list_skills and read_skill to provide custom skill storage (database, S3, etc.).
Use Riffer::Skills::Frontmatter.parse to parse raw SKILL.md content.
See Riffer::Skills::FilesystemBackend for the built-in implementation.
Direct Known Subclasses
Constant Summary collapse
- SKILL_FILENAME =
: String
"SKILL.md"
Instance Method Summary collapse
-
#initialize ⇒ Backend
constructor
A new instance of Backend.
-
#list_skills ⇒ Object
Returns frontmatter for all available skills.
-
#read_skill(name) ⇒ Object
Returns the full SKILL.md body (without frontmatter) for a skill.
Constructor Details
#initialize ⇒ Backend
Returns a new instance of Backend.
15 |
# File 'lib/riffer/skills/backend.rb', line 15 def initialize = nil |
Instance Method Details
#list_skills ⇒ Object
Returns frontmatter for all available skills.
Called once at the start of generate/stream.
Raises NotImplementedError if not implemented by subclass.
– : () -> Array
25 26 27 |
# File 'lib/riffer/skills/backend.rb', line 25 def list_skills raise NotImplementedError, "#{self.class} must implement #list_skills" end |
#read_skill(name) ⇒ Object
Returns the full SKILL.md body (without frontmatter) for a skill.
- name
-
the skill name to read.
Raises NotImplementedError if not implemented by subclass. Raises Riffer::ArgumentError if skill not found.
– : (String) -> String
38 39 40 |
# File 'lib/riffer/skills/backend.rb', line 38 def read_skill(name) raise NotImplementedError, "#{self.class} must implement #read_skill" end |