Class: SkillBench::Services::SkillResolver
- Inherits:
-
Object
- Object
- SkillBench::Services::SkillResolver
- Defined in:
- lib/skill_bench/services/skill_resolver.rb
Overview
Resolves a skill identifier to a Skill model instance. Supports both direct paths (containing ‘/’) and skill names (searched recursively).
Class Method Summary collapse
-
.call(identifier, base_path = 'skills/') ⇒ SkillBench::Models::Skill
Resolves a skill identifier to a Skill instance.
Instance Method Summary collapse
-
#call ⇒ SkillBench::Models::Skill
Resolves the skill identifier.
-
#initialize(identifier, base_path = 'skills/') ⇒ SkillResolver
constructor
A new instance of SkillResolver.
Constructor Details
#initialize(identifier, base_path = 'skills/') ⇒ SkillResolver
Returns a new instance of SkillResolver.
22 23 24 25 |
# File 'lib/skill_bench/services/skill_resolver.rb', line 22 def initialize(identifier, base_path = 'skills/') @identifier = identifier @base_path = base_path end |
Class Method Details
.call(identifier, base_path = 'skills/') ⇒ SkillBench::Models::Skill
Resolves a skill identifier to a Skill instance.
16 17 18 |
# File 'lib/skill_bench/services/skill_resolver.rb', line 16 def self.call(identifier, base_path = 'skills/') new(identifier, base_path).call end |
Instance Method Details
#call ⇒ SkillBench::Models::Skill
Resolves the skill identifier.
31 32 33 34 35 |
# File 'lib/skill_bench/services/skill_resolver.rb', line 31 def call return resolve_by_path if identifier.include?('/') resolve_by_name end |