class WatchDoge::Notification::Base

Public Class Methods

new(opt) click to toggle source
# File lib/watchdoge/notification/base.rb, line 13
def initialize opt
  @message_queue = []
end

Public Instance Methods

flush() click to toggle source
# 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() click to toggle source
# File lib/watchdoge/notification/base.rb, line 21
def msg_size
  @message_queue.size
end
push(message) click to toggle source
# File lib/watchdoge/notification/base.rb, line 17
def push message
  @message_queue << message
end