Class: Consist::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/consist/resolver.rb

Instance Method Summary collapse

Constructor Details

#initialize(pwd:) ⇒ Resolver

Returns a new instance of Resolver.



5
6
7
# File 'lib/consist/resolver.rb', line 5

def initialize(pwd:)
  @pwd = pwd
end

Instance Method Details

#resolve_artifact(type:, id:) ⇒ Object



9
10
11
12
13
14
# File 'lib/consist/resolver.rb', line 9

def resolve_artifact(type:, id:)
  file_name = %i[recipe step].include?(type) ? "#{id}.rb" : id.to_s
  target_path = File.join(Consist.consist_dir, "#{type}s", file_name)
  artifact_path = File.expand_path(target_path, @pwd)
  File.read(artifact_path)
end