class ConcourseObjects::Step

Constants

ACCEPTABLE_VERSIONS
DEFAULT_PRIVILEGED
DEFAULT_TRIGGER
DEFAULT_VERSION
IsAction
IsGet
IsPut
IsTask
TYPES
UsesResource

Public Class Methods

new(options = {}) { |this, options| ... } click to toggle source
Calls superclass method ConcourseObjects::Object::new
# File lib/concourse-objects.rb, line 229
def initialize(options = {})
  super(options) # first pass, as some keys are only acceptable if others are set first.
  super(options) do |this, options|
    raise KeyError, "#{self.class.inspect} is missing one of: (#{TYPES.join(' || ')})" unless TYPES.any? { |key| options.key?(key) }
    raise KeyError, "#{self.class.inspect} is missing one of: (config || file)" if this.task? unless %i[config file].any? { |key| options.key?(key) }
    yield this, options if block_given?
  end
end
to_proc() click to toggle source
# File lib/concourse-objects.rb, line 309
def self.to_proc
  Proc.new do |*rest|
    self.call(*rest)
  end
end

Public Instance Methods

name() click to toggle source
# File lib/concourse-objects.rb, line 289
def name
  case type
  when :get  then @get
  when :put  then @put
  when :task then @task
  else nil
  end
end
type() click to toggle source
# File lib/concourse-objects.rb, line 298
def type
  return :get         if @get
  return :put         if @put
  return :task        if @task
  return :in_parallel if @in_parallel
  return :do          if @do
  return :try         if @try
  return :aggregate   if @aggregate
  nil
end
version=(version) click to toggle source
# File lib/concourse-objects.rb, line 273
def version=(version)
  case version
  when Hash then @version = version
  when nil  then remove_instance_variable(:@version)
  else
    String(version).yield_self do |version|
      unless ACCEPTABLE_VERSIONS.any? { |av| av === version }
        raise TypeError, %{#{self.class.inspect} expects :version to be one of: #{ACCEPTABLE_VERSIONS}, instead got: "#{version}"}
      end
      @version = version
    end
  end
end