Class: WatchDoge::Notification::Base
- Inherits:
-
Object
- Object
- WatchDoge::Notification::Base
show all
- Defined in:
- lib/watchdoge/notification/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(opt) ⇒ Base
Returns a new instance of Base.
13
14
15
|
# File 'lib/watchdoge/notification/base.rb', line 13
def initialize opt
@message_queue = []
end
|
Instance Method Details
#flush ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/watchdoge/notification/base.rb', line 25
def flush
@message_queue.each do |message|
case message
when String
puts message
when ChunkyPNG::Image
File.write 'image.png', message.to_blob
when WatchDoge::PixelTest
File.write 'image.png', message.diff.to_blob
end
end
@message_queue = []
end
|
#msg_size ⇒ Object
21
22
23
|
# File 'lib/watchdoge/notification/base.rb', line 21
def msg_size
@message_queue.size
end
|
#push(message) ⇒ Object
17
18
19
|
# File 'lib/watchdoge/notification/base.rb', line 17
def push message
@message_queue << message
end
|