Class: Onceler::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/onceler/configuration.rb

Instance Method Summary collapse

Instance Method Details

#before(scope, &block) ⇒ Object



11
12
13
# File 'lib/onceler/configuration.rb', line 11

def before(scope, &block)
  callbacks[scope][:before] << block
end

#callbacksObject



15
16
17
18
19
20
21
# File 'lib/onceler/configuration.rb', line 15

def callbacks
  @callbacks ||= Hash.new do |scopes, scope|
    scopes[scope] = Hash.new do |timings, timing|
      timings[timing] = []
    end
  end
end

#run_callbacks(scope, timing) ⇒ Object



23
24
25
# File 'lib/onceler/configuration.rb', line 23

def run_callbacks(scope, timing)
  callbacks[scope][timing].each(&:call)
end