Class: Producer::Core::Action

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/producer/core/action.rb

Constant Summary collapse

INSPECT_ARGUMENTS_SUM_LEN =
68

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, *args) ⇒ Action

Returns a new instance of Action.



13
14
15
16
17
18
# File 'lib/producer/core/action.rb', line 13

def initialize env, *args
  @env        = env
  @arguments  = args
  @options    = @arguments[-1].kind_of?(Hash) ? @arguments.pop : {}
  setup if respond_to? :setup
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



11
12
13
# File 'lib/producer/core/action.rb', line 11

def arguments
  @arguments
end

#envObject (readonly)

Returns the value of attribute env.



11
12
13
# File 'lib/producer/core/action.rb', line 11

def env
  @env
end

#optionsObject (readonly)

Returns the value of attribute options.



11
12
13
# File 'lib/producer/core/action.rb', line 11

def options
  @options
end

Instance Method Details

#nameObject



20
21
22
# File 'lib/producer/core/action.rb', line 20

def name
  self.class.name.split('::').last.downcase
end

#to_sObject



24
25
26
# File 'lib/producer/core/action.rb', line 24

def to_s
  [name, inspect_arguments].join ' '
end