Class: Lita::Handlers::Reminder

Inherits:
Handler
  • Object
show all
Defined in:
lib/lita/handlers/reminder.rb

Constant Summary collapse

@@mutex =
Mutex.new
@@runner =
ReminderRunner.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(robot) ⇒ Reminder

Returns a new instance of Reminder.



31
32
33
34
35
36
# File 'lib/lita/handlers/reminder.rb', line 31

def initialize(robot)
  super(robot)
  @@mutex.synchronize do
    @@runner.start(robot, redis)
  end
end

Instance Attribute Details

#schedulerObject

Returns the value of attribute scheduler.



29
30
31
# File 'lib/lita/handlers/reminder.rb', line 29

def scheduler
  @scheduler
end

Class Method Details

.runnerObject



88
89
90
# File 'lib/lita/handlers/reminder.rb', line 88

def runner
  @@runner
end

Instance Method Details

#add(response) ⇒ Object



38
39
40
41
42
# File 'lib/lita/handlers/reminder.rb', line 38

def add(response)
  @@mutex.synchronize do
    @@runner.add(response)
  end
end

#add_domains(response) ⇒ Object



69
70
71
72
73
# File 'lib/lita/handlers/reminder.rb', line 69

def add_domains(response) 
  @@mutex.synchronize do
    @@runner.add_domains(response)
  end
end

#clear(response) ⇒ Object



58
59
60
61
62
63
# File 'lib/lita/handlers/reminder.rb', line 58

def clear(response)
  @@mutex.synchronize do
    @@runner.clear
    response.reply "cleared all reminders"
  end
end

#delete(response) ⇒ Object



48
49
50
51
52
# File 'lib/lita/handlers/reminder.rb', line 48

def delete(response)
  @@mutex.synchronize do
    @@runner.delete(response)
  end
end

#delete_domains(response) ⇒ Object



75
76
77
78
79
# File 'lib/lita/handlers/reminder.rb', line 75

def delete_domains(response)
  @@mutex.synchronize do
    @@runner.delete_domains(response)
  end
end

#done(response) ⇒ Object



43
44
45
46
47
# File 'lib/lita/handlers/reminder.rb', line 43

def done(response)
  @@mutex.synchronize do
    @@runner.done(response)
  end
end

#list(response) ⇒ Object



53
54
55
56
57
# File 'lib/lita/handlers/reminder.rb', line 53

def list(response)
  @@mutex.synchronize do
    @@runner.list(response)
  end
end

#list_domains(response) ⇒ Object



81
82
83
84
85
# File 'lib/lita/handlers/reminder.rb', line 81

def list_domains(response)
  @@mutex.synchronize do
    @@runner.list_domains(response)
  end
end

#time(response) ⇒ Object



65
66
67
# File 'lib/lita/handlers/reminder.rb', line 65

def time(response)
  response.reply Time.now.to_s
end