Class: Twterm::Event::Notification
- Defined in:
- lib/twterm/event/notification.rb
Instance Attribute Summary collapse
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #color ⇒ Object
- #fields ⇒ Object
-
#initialize(type, message) ⇒ Notification
constructor
A new instance of Notification.
Methods included from Utils
Constructor Details
#initialize(type, message) ⇒ Notification
Returns a new instance of Notification.
8 9 10 11 12 |
# File 'lib/twterm/event/notification.rb', line 8 def initialize(type, ) super(type, CGI.unescapeHTML()) @time = Time.now end |
Instance Attribute Details
#time ⇒ Object (readonly)
Returns the value of attribute time.
6 7 8 |
# File 'lib/twterm/event/notification.rb', line 6 def time @time end |
Instance Method Details
#color ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/twterm/event/notification.rb', line 21 def color case type when :error [:white, :red] when :message [:white, :blue] else [:white, :black] end end |
#fields ⇒ Object
14 15 16 17 18 19 |
# File 'lib/twterm/event/notification.rb', line 14 def fields { type: Symbol, message: String } end |