Sha256: b5b965d6eea3e8b0146ea6650660a5092d0c15cf1769727a649ee326b15d5518
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
module Buildkite module Builder class StepCollection attr_reader :templates attr_reader :steps def initialize(templates) @templates = templates @steps = [] end def each(*types) types = types.flatten @steps.each do |step| if types.include?(step.class.to_sym) yield step elsif step.is_a?(Group) step.data.steps.each(*types) do |step| yield step end elsif types.empty? yield step end end end def find(key) @steps.find { |step| step.has?(:key) && step.key == key.to_s } end def find!(key) find(key) || raise(ArgumentError, "Can't find step with key: #{key}") end def add(step_class, template = nil, **args, &block) @steps.push(step_class.new(self, template, **args, &block)).last end def push(step) @steps.push(step) end def to_definition @steps.map(&:to_h) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
buildkite-builder-3.9.0 | lib/buildkite/builder/step_collection.rb |