Class: GitPrepareBranch::Command
- Inherits:
-
Object
- Object
- GitPrepareBranch::Command
- Defined in:
- lib/git-prepare-branch/command.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #call(context) ⇒ Object
- #description ⇒ Object
-
#initialize(key, name, command, options = {}) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(key, name, command, options = {}) ⇒ Command
Returns a new instance of Command.
7 8 9 10 11 12 |
# File 'lib/git-prepare-branch/command.rb', line 7 def initialize(key, name, command, ={}) @key = key @name = name @command = command @options = end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
5 6 7 |
# File 'lib/git-prepare-branch/command.rb', line 5 def command @command end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'lib/git-prepare-branch/command.rb', line 5 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/git-prepare-branch/command.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/git-prepare-branch/command.rb', line 5 def @options end |
Instance Method Details
#call(context) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/git-prepare-branch/command.rb', line 14 def call(context) inputs = capture_inputs(context) run_proc(context, inputs) if command.is_a?(Proc) run_as_shell_command(context, inputs) if command.is_a?(String) context.terminal.prompt_to_continue if [:prompt_to_continue] end |
#description ⇒ Object
21 22 23 |
# File 'lib/git-prepare-branch/command.rb', line 21 def description [:description] end |