Module: Collector

Defined in:
lib/plus_log.rb

Defined Under Namespace

Classes: Object, Plus_log

Class Method Summary collapse

Class Method Details

.+@Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/plus_log.rb', line 9

def nil.+@
  klass, name = Thread.current[:method]
  method = klass.instance_method(name)
  klass.send(:define_method, name) do |*args, &block|
    Collector.log "enter #{name}"
    res = Collector.new { method.bind(self).call(*args, &block) }
    Collector.log "exit #{name}"
    res
  end
end