module SideBoom::Attributes

Attributes define the methods that can be set on both Pipeline, Stage, and

Job level. Attributes set at pipeline level can be overriden at either stage- or job-level. Stage level attributes can be overriden by any of its jobs.

Public Class Methods

array_attribute(*attrs) click to toggle source
# File lib/side_boom/attributes.rb, line 31
def array_attribute(*attrs)
  attrs.each do |attr|
    define_method(attr) do |args|
      args = [args] if args.is_a?(String)

      attributes[attr.to_s] = args.map(&:to_s)
    end
  end
end
boolean_attribute(*attrs) click to toggle source
# File lib/side_boom/attributes.rb, line 7
def boolean_attribute(*attrs)
  attrs.each do |attr|
    define_method("#{attr}!") do
      @attributes[attr.to_s] = true
    end

    define_method("dis#{attr}!") do
      @attributes[attr.to_s] = false
    end

    define_method(attr) do |arg|
      @attributes[attr.to_s] = !!arg
    end
  end
end
string_attribute(*attrs) click to toggle source
# File lib/side_boom/attributes.rb, line 23
def string_attribute(*attrs)
  attrs.each do |attr|
    define_method(attr) do |arg|
      attributes[attr.to_s] = arg.to_s
    end
  end
end

Public Instance Methods

attributes() click to toggle source
# File lib/side_boom/attributes.rb, line 46
def attributes
  @attributes ||= {}
end