Last active
December 14, 2015 23:48
-
-
Save coderhs/5167773 to your computer and use it in GitHub Desktop.
Why my alarm stopped working.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Alarm | |
def initialize(alarm_time,music = "/mount/data2/Songs/11.Mazhathullikal.mp3") | |
@alarm_time = alarm_time | |
@music = music | |
@run = true | |
end | |
def its_time | |
system("vlc #{@music} --volume 512") | |
end | |
def check_time | |
while @run | |
if Time.now >= @alarm_time | |
its_time | |
@run = false | |
end | |
sleep(@alarm_time-Time.now) | |
end | |
end | |
end | |
@alarm = Alarm.new Time.new 2013,03,15,6 | |
@alarm.check_time |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment