Class: Action
- Inherits:
-
Object
show all
- Defined in:
- lib/action.rb
Overview
represents one action to be performed in the shell can assemble a command line from a command and args
Defined Under Namespace
Classes: NotAllowedInEnvError
Instance Method Summary
collapse
Constructor Details
#initialize(config, args) ⇒ Action
Returns a new instance of Action.
10
11
12
13
|
# File 'lib/action.rb', line 10
def initialize(config, args)
@config = config
@args = args
end
|
Instance Method Details
#alias ⇒ Object
29
30
31
|
# File 'lib/action.rb', line 29
def alias
@config["alias"]
end
|
#command ⇒ Object
33
34
35
|
# File 'lib/action.rb', line 33
def command
@config["command"]
end
|
#config_errors ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/action.rb', line 49
def config_errors
@config_errors ||= begin
errors = []
errors << "No 'command' specified in 'action'." unless @config['command']
errors
end
end
|
#config_valid? ⇒ Boolean
45
46
47
|
# File 'lib/action.rb', line 45
def config_valid?
config_errors.empty?
end
|
#description ⇒ Object
37
38
39
|
# File 'lib/action.rb', line 37
def description
@config["description"]
end
|
#skip_hooks?(name) ⇒ Boolean
41
42
43
|
# File 'lib/action.rb', line 41
def skip_hooks?(name)
@config["skip_#{name}_hooks"]
end
|
#to_s ⇒ Object
25
26
27
|
# File 'lib/action.rb', line 25
def to_s
"#{command} #{@args.join(' ')}".strip
end
|