Class: Message

Inherits:
Object
  • Object
show all
Defined in:
lib/tell_me.rb

Overview

— CLASSES —

Instance Method Summary collapse

Constructor Details

#initialize(content, date) ⇒ Message

Returns a new instance of Message.



13
14
15
16
17
# File 'lib/tell_me.rb', line 13

def initialize(content, date)
  @content = content
  @date = date
  @scheduler = Rufus::Scheduler.new
end

Instance Method Details

#notifyObject



27
28
29
30
31
32
33
34
# File 'lib/tell_me.rb', line 27

def notify
  Notifier.notify(
    title: 'Hey',
    message: @content,
    sound: 'default'
  )
  @scheduler.shutdown
end

#scheduleObject



19
20
21
22
23
24
25
# File 'lib/tell_me.rb', line 19

def schedule
  date = @date.strftime "%Y/%m/%d %H:%M"
  @scheduler.at date do
    notify
  end
  @scheduler.join
end