Class: Action
- Inherits:
-
Object
- Object
- Action
- 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
Instance Method Summary collapse
- #alias ⇒ Object
- #command ⇒ Object
- #description ⇒ Object
-
#initialize(config, args) ⇒ Action
constructor
A new instance of Action.
- #run ⇒ Object
- #skip_hooks?(name) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(config, args) ⇒ Action
Returns a new instance of Action.
8 9 10 11 |
# File 'lib/action.rb', line 8 def initialize(config, args) @config = config @args = args end |
Instance Method Details
#alias ⇒ Object
23 24 25 |
# File 'lib/action.rb', line 23 def alias @config["alias"] end |
#command ⇒ Object
27 28 29 |
# File 'lib/action.rb', line 27 def command @config["command"] end |
#description ⇒ Object
31 32 33 |
# File 'lib/action.rb', line 31 def description @config["description"] end |
#run ⇒ Object
13 14 15 16 17 |
# File 'lib/action.rb', line 13 def run Secrets.load if load_secrets? Kernel.exec(to_s) end |
#skip_hooks?(name) ⇒ Boolean
35 36 37 |
# File 'lib/action.rb', line 35 def skip_hooks?(name) @config["skip_#{name}_hooks"] end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/action.rb', line 19 def to_s "#{command} #{@args.join(' ')}".strip end |