Class: AnnotationMonitor
- Inherits:
-
Object
- Object
- AnnotationMonitor
- Defined in:
- lib/simple-annotations.rb
Constant Summary collapse
- @@annotated =
{}
- @@before =
TracePoint.new(:call) do |tp| selected_class = tp.defined_class.to_s.to_sym called_method = tp.method_id if AnnotationMonitor::registered.include? selected_class then annotations = AnnotationMonitor::registered[selected_class][called_method] if annotations.include? :before then annotations[:before].call end end end
- @@after =
TracePoint.new(:return) do |tp| selected_class = tp.defined_class.to_s.to_sym called_method = tp.method_id if AnnotationMonitor::registered.include? selected_class then annotations = AnnotationMonitor::registered[selected_class][called_method] if annotations.include? :after then annotations[:after].call end end end
Class Method Summary collapse
Class Method Details
.register(aClass) ⇒ Object
102 103 104 |
# File 'lib/simple-annotations.rb', line 102 def AnnotationMonitor::register(aClass) @@annotated[aClass] = {} end |
.registered ⇒ Object
106 107 108 |
# File 'lib/simple-annotations.rb', line 106 def AnnotationMonitor::registered return @@annotated end |