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



19
20
21
# File 'lib/onceler/configuration.rb', line 19

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

#callbacksObject



23
24
25
26
27
28
29
# File 'lib/onceler/configuration.rb', line 23

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

#include(mod) ⇒ Object



15
16
17
# File 'lib/onceler/configuration.rb', line 15

def include(mod)
  modules << mod
end

#modulesObject



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

def modules
  @modules ||= []
end

#run_callbacks(scope, timing) ⇒ Object



31
32
33
# File 'lib/onceler/configuration.rb', line 31

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