Class: Elevate::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/elevate/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_callbackObject (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_callbackObject (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_callbackObject (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_callbackObject (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