Class: GitRunner::Instruction::Base
- Inherits:
-
Object
- Object
- GitRunner::Instruction::Base
- Defined in:
- lib/git-runner/instructions/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#opts ⇒ Object
Returns the value of attribute opts.
Instance Method Summary collapse
- #fail! ⇒ Object
-
#initialize(args, opts = {}) ⇒ Base
constructor
A new instance of Base.
- #perform ⇒ Object
- #run ⇒ Object
- #should_run? ⇒ Boolean
Constructor Details
#initialize(args, opts = {}) ⇒ Base
Returns a new instance of Base.
7 8 9 10 |
# File 'lib/git-runner/instructions/base.rb', line 7 def initialize(args, opts={}) self.args = args self.opts = opts end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
4 5 6 |
# File 'lib/git-runner/instructions/base.rb', line 4 def args @args end |
#branch ⇒ Object
Returns the value of attribute branch.
4 5 6 |
# File 'lib/git-runner/instructions/base.rb', line 4 def branch @branch end |
#opts ⇒ Object
Returns the value of attribute opts.
4 5 6 |
# File 'lib/git-runner/instructions/base.rb', line 4 def opts @opts end |
Instance Method Details
#fail! ⇒ Object
31 32 33 |
# File 'lib/git-runner/instructions/base.rb', line 31 def fail! raise Failure.new(self) end |
#perform ⇒ Object
12 13 14 |
# File 'lib/git-runner/instructions/base.rb', line 12 def perform # No-op end |
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/git-runner/instructions/base.rb', line 16 def run if should_run? perform Text.new_line if opts[:fail] raise Failure.new(self) end end end |
#should_run? ⇒ Boolean
27 28 29 |
# File 'lib/git-runner/instructions/base.rb', line 27 def should_run? true end |