Class: Runciter::Task
- Inherits:
-
Object
- Object
- Runciter::Task
- Defined in:
- lib/runciter/task.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(app, name, opts = {}) ⇒ Task
constructor
A new instance of Task.
- #run!(&block) ⇒ Object
Constructor Details
#initialize(app, name, opts = {}) ⇒ Task
Returns a new instance of Task.
6 7 8 9 10 11 12 |
# File 'lib/runciter/task.rb', line 6 def initialize(app, name, opts = {}) @app = app @name = name @opts = opts register! end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/runciter/task.rb', line 4 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/runciter/task.rb', line 3 def name @name end |
Instance Method Details
#run!(&block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/runciter/task.rb', line 14 def run!(&block) run = Run.new(@app, self, @opts) begin block.call(run) run.finish! # finish! rescues its own exceptions rescue run.die!($!) # die! rescues its own exceptions raise $! # reraise the exception for the user program to handle end end |