class Ruboty::Reminder::Task
Attributes
hash[R]
thread[R]
Public Class Methods
new(hash)
click to toggle source
# File lib/ruboty/reminder/task.rb, line 6 def initialize(hash) @hash = hash @thread = nil end
Public Instance Methods
start(robot)
click to toggle source
# File lib/ruboty/reminder/task.rb, line 11 def start(robot) wait_time = hash[:unixtime] - Time.now.to_i @thread = Thread.start do sleep(wait_time) Message.new( hash.except(:id, :body, :year, :month, :day, :hour, :min, :unixtime).merge(robot: robot) ).reply(hash[:body]) robot.brain.data[NAMESPACE].delete(hash[:id]) end end