Class: Buildkite::Builder::TemplateManager

Inherits:
Object
  • Object
show all
Defined in:
lib/buildkite/builder/template_manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ TemplateManager

Returns a new instance of TemplateManager.



4
5
6
7
8
9
10
# File 'lib/buildkite/builder/template_manager.rb', line 4

def initialize(root)
  @templates = {}

  Loaders::Templates.load(root).each do |name, asset|
    @templates[name.to_s] = asset
  end
end

Instance Method Details

#find(name) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/buildkite/builder/template_manager.rb', line 12

def find(name)
  return unless name

  unless definition = @templates[name.to_s]
    raise ArgumentError, "Template not defined: #{name}"
  end

  definition
end