Module: IIRC::Ambient::Events
- Included in:
- Verbs
- Defined in:
- lib/iirc/modules/ambient.rb
Instance Method Summary collapse
- #ambient_event ⇒ Object private
- #ambient_sender ⇒ Object private
- #ambient_target ⇒ Object private
- #configure_ambient_events ⇒ Object private
- #set_ambient_event(evt) ⇒ Object private
- #with_ambient_event(evt) ⇒ Object private
Instance Method Details
#ambient_event ⇒ Object (private)
32 33 34 |
# File 'lib/iirc/modules/ambient.rb', line 32 def ambient_event Thread.current[:ambient_event] end |
#ambient_sender ⇒ Object (private)
37 |
# File 'lib/iirc/modules/ambient.rb', line 37 def ambient_sender; ambient_event&.sender; end |
#ambient_target ⇒ Object (private)
36 |
# File 'lib/iirc/modules/ambient.rb', line 36 def ambient_target; ambient_event&.target; end |
#configure_ambient_events ⇒ Object (private)
28 29 30 |
# File 'lib/iirc/modules/ambient.rb', line 28 def configure_ambient_events hook :set_ambient_event end |
#set_ambient_event(evt) ⇒ Object (private)
39 40 41 |
# File 'lib/iirc/modules/ambient.rb', line 39 def set_ambient_event(evt) Thread.current[:ambient_event] = evt end |
#with_ambient_event(evt) ⇒ Object (private)
43 44 45 46 47 48 49 50 51 |
# File 'lib/iirc/modules/ambient.rb', line 43 def with_ambient_event(evt) initial_event = ambient_event set_ambient_event(evt) begin yield evt ensure set_ambient_event(initial_event) end end |