Class: BundlerSkills::DiscoveredSkill

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler_skills/discovered_skill.rb

Overview

One skill found inside a dependency gem.

source_path : absolute path to the directory containing SKILL.md link_name : symlink basename, “gem-<gem>–<skill>” (double-hyphen boundary

so a gem name containing single hyphens stays unambiguous)

Constant Summary collapse

"gem-"
BOUNDARY =
"--"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gem_name:, skill_name:, source_path:) ⇒ DiscoveredSkill

Returns a new instance of DiscoveredSkill.



15
16
17
18
19
# File 'lib/bundler_skills/discovered_skill.rb', line 15

def initialize(gem_name:, skill_name:, source_path:)
  @gem_name = gem_name
  @skill_name = skill_name
  @source_path = source_path
end

Instance Attribute Details

#gem_nameObject (readonly)

Returns the value of attribute gem_name.



13
14
15
# File 'lib/bundler_skills/discovered_skill.rb', line 13

def gem_name
  @gem_name
end

#skill_nameObject (readonly)

Returns the value of attribute skill_name.



13
14
15
# File 'lib/bundler_skills/discovered_skill.rb', line 13

def skill_name
  @skill_name
end

#source_pathObject (readonly)

Returns the value of attribute source_path.



13
14
15
# File 'lib/bundler_skills/discovered_skill.rb', line 13

def source_path
  @source_path
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



25
26
27
28
29
30
# File 'lib/bundler_skills/discovered_skill.rb', line 25

def ==(other)
  other.is_a?(DiscoveredSkill) &&
    gem_name == other.gem_name &&
    skill_name == other.skill_name &&
    source_path == other.source_path
end

#hashObject



33
34
35
# File 'lib/bundler_skills/discovered_skill.rb', line 33

def hash
  [gem_name, skill_name, source_path].hash
end


21
22
23
# File 'lib/bundler_skills/discovered_skill.rb', line 21

def link_name
  "#{LINK_PREFIX}#{gem_name}#{BOUNDARY}#{skill_name}"
end