Class: ShakeNBake::DSL

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/shake_n_bake/dsl.rb

Overview

DSL for Shake n Bake

Instance Method Summary collapse

Instance Method Details

#bake(&block) ⇒ Object

Bake when result exec block



16
17
18
# File 'lib/shake_n_bake/dsl.rb', line 16

def bake(&block)
  @bake_proc = block if block_given?
end

#runObject

Start your engines!



21
22
23
24
25
26
27
28
29
# File 'lib/shake_n_bake/dsl.rb', line 21

def run
  register_signal_handlers
  loop do
    break if shutdown?
    result = self.instance_eval &@shake_proc
    self.instance_exec(result, &@bake_proc) if result
    sleep INTERVAL || 2
  end
end

#setup(&block) ⇒ Object

Setup Method for registering instance vars



6
7
8
# File 'lib/shake_n_bake/dsl.rb', line 6

def setup(&block)
  self.instance_eval(&block) if block_given? 
end

#shake(&block) ⇒ Object

Shake ping the queue or data your watching



11
12
13
# File 'lib/shake_n_bake/dsl.rb', line 11

def shake(&block)
  @shake_proc = block if block_given?
end