Class: Elevate::DSL
- Inherits:
-
Object
- Object
- Elevate::DSL
- Defined in:
- lib/elevate/dsl.rb
Instance Attribute Summary collapse
-
#finish_callback ⇒ Object
readonly
Returns the value of attribute finish_callback.
-
#start_callback ⇒ Object
readonly
Returns the value of attribute start_callback.
-
#task_callback ⇒ Object
readonly
Returns the value of attribute task_callback.
-
#update_callback ⇒ Object
readonly
Returns the value of attribute update_callback.
Instance Method Summary collapse
-
#initialize(&block) ⇒ DSL
constructor
A new instance of DSL.
- #on_finish(&block) ⇒ Object
- #on_start(&block) ⇒ Object
- #on_update(&block) ⇒ Object
- #task(&block) ⇒ Object
Constructor Details
#initialize(&block) ⇒ DSL
Returns a new instance of DSL.
3 4 5 |
# File 'lib/elevate/dsl.rb', line 3 def initialize(&block) instance_eval(&block) end |
Instance Attribute Details
#finish_callback ⇒ Object (readonly)
Returns the value of attribute finish_callback.
7 8 9 |
# File 'lib/elevate/dsl.rb', line 7 def finish_callback @finish_callback end |
#start_callback ⇒ Object (readonly)
Returns the value of attribute start_callback.
8 9 10 |
# File 'lib/elevate/dsl.rb', line 8 def start_callback @start_callback end |
#task_callback ⇒ Object (readonly)
Returns the value of attribute task_callback.
9 10 11 |
# File 'lib/elevate/dsl.rb', line 9 def task_callback @task_callback end |
#update_callback ⇒ Object (readonly)
Returns the value of attribute update_callback.
10 11 12 |
# File 'lib/elevate/dsl.rb', line 10 def update_callback @update_callback end |
Instance Method Details
#on_finish(&block) ⇒ Object
12 13 14 15 16 |
# File 'lib/elevate/dsl.rb', line 12 def on_finish(&block) raise "on_finish blocks must accept two parameters" unless block.arity == 2 @finish_callback = block end |
#on_start(&block) ⇒ Object
18 19 20 21 22 |
# File 'lib/elevate/dsl.rb', line 18 def on_start(&block) raise "on_start blocks must accept zero parameters" unless block.arity == 0 @start_callback = block end |
#on_update(&block) ⇒ Object
24 25 26 |
# File 'lib/elevate/dsl.rb', line 24 def on_update(&block) @update_callback = block end |
#task(&block) ⇒ Object
28 29 30 31 32 |
# File 'lib/elevate/dsl.rb', line 28 def task(&block) raise "task blocks must accept zero parameters" unless block.arity == 0 @task_callback = block end |