Class: Twterm::Event::Notification

Inherits:
Base
  • Object
show all
Defined in:
lib/twterm/event/notification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

check_type

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, message)
  super(type, CGI.unescapeHTML(message))

  @time = Time.now
end

Instance Attribute Details

#timeObject (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

#colorObject



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

#fieldsObject



14
15
16
17
18
19
# File 'lib/twterm/event/notification.rb', line 14

def fields
  {
    type: Symbol,
    message: String
  }
end