Class: StreamBot::Event
- Inherits:
-
Object
- Object
- StreamBot::Event
- Defined in:
- lib/streambot/event.rb
Overview
event class
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ Event
constructor
A new instance of Event.
- #receive(method = nil, &block) ⇒ Object
- #trigger(*args) ⇒ Object
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/streambot/event.rb', line 4 def name @name end |
Instance Method Details
#receive(method = nil, &block) ⇒ Object
11 12 13 14 15 |
# File 'lib/streambot/event.rb', line 11 def receive(method=nil, & block) LOG.debug "receive: #{self.name}" @handler = method if !method.nil? @handler = block if !block.nil? end |
#trigger(*args) ⇒ Object
17 18 19 20 |
# File 'lib/streambot/event.rb', line 17 def trigger(* args) LOG.debug "trigger: #{self.name}" @handler.call(*args) if !@handler.nil? end |