Class: MethodObserver
- Inherits:
-
Object
- Object
- MethodObserver
- Defined in:
- lib/method_observer.rb
Constant Summary collapse
- VERSION =
'0.0.1'
Class Method Summary collapse
- .after(&block) ⇒ Object
- .around(&block) ⇒ Object
- .before(&block) ⇒ Object
- .observe(klass, options) ⇒ Object
Class Method Details
.after(&block) ⇒ Object
17 18 19 |
# File 'lib/method_observer.rb', line 17 def after(&block) @after = block end |
.around(&block) ⇒ Object
21 22 23 |
# File 'lib/method_observer.rb', line 21 def around(&block) @around = block end |
.before(&block) ⇒ Object
13 14 15 |
# File 'lib/method_observer.rb', line 13 def before(&block) @before = block end |
.observe(klass, options) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/method_observer.rb', line 25 def observe(klass, ) .fetch(:instance, []).each do |method| observe_instance_method klass, method end .fetch(:class, []).each do |method| observe_class_method klass, method end end |