Class: Sqreen::RunWhenCalledCB

Inherits:
CB
  • Object
show all
Defined in:
lib/sqreen/run_when_called_cb.rb

Constant Summary

Constants inherited from CB

CB::DEFAULT_PRIORITY

Instance Attribute Summary

Attributes inherited from CB

#klass, #method, #overtimeable

Instance Method Summary collapse

Methods inherited from CB

#failing?, #framework, #overtime!, #post?, #pre?, #priority, #to_s, #whitelisted?

Constructor Details

#initialize(klass, method, &block) ⇒ RunWhenCalledCB

Returns a new instance of RunWhenCalledCB.



10
11
12
13
14
15
# File 'lib/sqreen/run_when_called_cb.rb', line 10

def initialize(klass, method, &block)
  super(klass, method)

  raise 'missing block' unless block_given?
  @block = block
end

Instance Method Details

#pre(_inst, _args, _budget = nil, &_block) ⇒ Object



17
18
19
20
21
# File 'lib/sqreen/run_when_called_cb.rb', line 17

def pre(_inst, _args, _budget = nil, &_block)
  # FIXME: implement this removal
  @remove_me = true
  @block.call
end