class Producer::Core::Action

Constants

INSPECT_ARGUMENTS_SUM_LEN

Attributes

arguments[R]
env[R]
options[R]

Public Class Methods

new(env, *args, **options) click to toggle source
# File lib/producer/core/action.rb, line 12
def initialize env, *args, **options
  @env        = env
  @arguments  = args
  @options    = options
  setup if respond_to? :setup
end

Public Instance Methods

name() click to toggle source
# File lib/producer/core/action.rb, line 19
def name
  self.class.name.split('::').last.downcase
end
to_s() click to toggle source
# File lib/producer/core/action.rb, line 23
def to_s
  [name, inspect_arguments].join ' '
end

Private Instance Methods

check_arguments_size!(size) click to toggle source
# File lib/producer/core/action.rb, line 33
def check_arguments_size! size
  return if arguments.compact.size == size
  fail ArgumentError, '`%s\' action requires %d arguments' % [name, size]
end
convert_options(conversions) click to toggle source
# File lib/producer/core/action.rb, line 38
def convert_options conversions
  conversions.each do |original, convertion|
    options[convertion] = options.delete original if options.key? original
  end
end
inspect_arguments() click to toggle source
# File lib/producer/core/action.rb, line 29
def inspect_arguments
  @arguments.inspect[0, INSPECT_ARGUMENTS_SUM_LEN - name.length]
end