Class: Gloo::Core::EventManager
- Inherits:
-
Object
- Object
- Gloo::Core::EventManager
- Defined in:
- lib/gloo/core/event_manager.rb
Instance Method Summary collapse
-
#initialize ⇒ EventManager
constructor
Set up the event manager.
-
#on_load(obj = nil, in_heap = false) ⇒ Object
Run on_load scripts in the recently loaded object If no obj is given the script will be run in root.
-
#on_unload(obj) ⇒ Object
Run on_unload scripts in the object that will be unloaded.
Constructor Details
#initialize ⇒ EventManager
Set up the event manager.
15 16 17 |
# File 'lib/gloo/core/event_manager.rb', line 15 def initialize $log.debug 'event manager intialized...' end |
Instance Method Details
#on_load(obj = nil, in_heap = false) ⇒ Object
Run on_load scripts in the recently loaded object If no obj is given the script will be run in root.
23 24 25 26 27 28 29 |
# File 'lib/gloo/core/event_manager.rb', line 23 def on_load( obj = nil, in_heap = false ) return unless obj || in_heap $log.debug 'on_load event' arr = Gloo::Core::ObjFinder.by_name 'on_load', obj arr.each { |o| Gloo::Exec::Dispatch. 'run', o } end |
#on_unload(obj) ⇒ Object
Run on_unload scripts in the object that will be unloaded.
34 35 36 37 38 39 40 |
# File 'lib/gloo/core/event_manager.rb', line 34 def on_unload( obj ) return unless obj $log.debug 'on_unload event' arr = Gloo::Core::ObjFinder.by_name 'on_unload', obj arr.each { |o| Gloo::Exec::Dispatch. 'run', o } end |