Class: WatchDoge::Notification::Base
- Inherits:
-
Object
- Object
- WatchDoge::Notification::Base
- Defined in:
- lib/watchdoge/notification/base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #flush ⇒ Object
-
#initialize(opt) ⇒ Base
constructor
A new instance of Base.
- #msg_size ⇒ Object
- #push(message) ⇒ Object
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 || case when String puts when ChunkyPNG::Image File.write 'image.png', .to_blob when WatchDoge::PixelTest File.write 'image.png', .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_queue << end |