Class: CeilingCat::Event
- Inherits:
-
Object
- Object
- CeilingCat::Event
- Defined in:
- lib/ceiling_cat/event.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#room ⇒ Object
Returns the value of attribute room.
-
#time ⇒ Object
Returns the value of attribute time.
-
#type ⇒ Object
assume that all messages are just text unless the specific room type overrides it.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #handle ⇒ Object
-
#initialize(room, body, user, opts = {}) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(room, body, user, opts = {}) ⇒ Event
Returns a new instance of Event.
5 6 7 8 9 10 11 |
# File 'lib/ceiling_cat/event.rb', line 5 def initialize(room, body, user, opts={}) @room = room @body = body.to_s.strip @user = user @type = opts[:type] @time = opts[:time] || Time.now end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/ceiling_cat/event.rb', line 3 def body @body end |
#room ⇒ Object
Returns the value of attribute room.
3 4 5 |
# File 'lib/ceiling_cat/event.rb', line 3 def room @room end |
#time ⇒ Object
Returns the value of attribute time.
3 4 5 |
# File 'lib/ceiling_cat/event.rb', line 3 def time @time end |
#type ⇒ Object
assume that all messages are just text unless the specific room type overrides it.
24 25 26 |
# File 'lib/ceiling_cat/event.rb', line 24 def type @type end |
#user ⇒ Object
Returns the value of attribute user.
3 4 5 |
# File 'lib/ceiling_cat/event.rb', line 3 def user @user end |
Instance Method Details
#handle ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ceiling_cat/event.rb', line 13 def handle @room.plugins.each do |plugin| begin response = plugin.new(self).handle break if response.present? rescue => e @room.say("Whoops - there was a problem with #{plugin}: #{e}") end end end |