Class: Buildkite::Builder::Extension

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, **options, &block) ⇒ Extension

Returns a new instance of Extension.



32
33
34
35
36
37
38
# File 'lib/buildkite/builder/extension.rb', line 32

def initialize(context, **options, &block)
  @context = context
  @options = options
  @options_block = block

  prepare
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



28
29
30
# File 'lib/buildkite/builder/extension.rb', line 28

def context
  @context
end

#optionsObject (readonly)

Returns the value of attribute options.



29
30
31
# File 'lib/buildkite/builder/extension.rb', line 29

def options
  @options
end

#options_blockObject (readonly)

Returns the value of attribute options_block.



30
31
32
# File 'lib/buildkite/builder/extension.rb', line 30

def options_block
  @options_block
end

Class Method Details

.dsl(&block) ⇒ Object



8
9
10
11
# File 'lib/buildkite/builder/extension.rb', line 8

def dsl(&block)
  @dsl = Module.new(&block) if block_given?
  @dsl
end

.template(name = :default, &block) ⇒ Object



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

def template(name = :default, &block)
  name = name.to_s

  if block_given? && templates.key?(name)
    raise ArgumentError, "Template #{name} already registered in #{self.name}"
  end

  templates[name] ||= ExtensionTemplate.new(self, name, block)
end

.templatesObject



23
24
25
# File 'lib/buildkite/builder/extension.rb', line 23

def templates
  @templates ||= {}
end

Instance Method Details

#buildObject



40
41
42
# File 'lib/buildkite/builder/extension.rb', line 40

def build
  # Override to provide extra functionality.
end