class Onceler::Configuration
Public Instance Methods
after(scope, &block)
click to toggle source
# File lib/onceler/configuration.rb, line 15 def after(scope, &block) hooks[:after][scope] << block end
before(scope, &block)
click to toggle source
# File lib/onceler/configuration.rb, line 11 def before(scope, &block) hooks[:before][scope] << block end
hooks()
click to toggle source
# File lib/onceler/configuration.rb, line 19 def hooks @hooks ||= { before: {record: [], reset: []}, after: {record: [], reset: []} } end
run_hooks(timing, scope, context)
click to toggle source
# File lib/onceler/configuration.rb, line 26 def run_hooks(timing, scope, context) hooks[timing][scope].each do |hook| context ? context.instance_eval(&hook) : hook.call end end