Class: PairTimer
- Inherits:
-
Thread
- Object
- Thread
- PairTimer
- Defined in:
- lib/ruby_learner/pair_timer.rb
Instance Method Summary collapse
Instance Method Details
#popup_per_time_for_exe(time) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ruby_learner/pair_timer.rb', line 4 def popup_per_time_for_exe(time) loop do sleep time system('afplay /System/Library/Sounds/Submarine.aiff') o, e, s = Open3.capture3("osascript -e 'tell app \"System Events\" to display dialog \"#{time}s passed.\nPut cancel to stop pair-mode.\nPut OK to continue pair-mode.\"'") if o != "button returned:OK\n" puts 'pair timer is stopped.' Thread.kill(self) end end end |
#popup_per_time_for_non_exe(time) ⇒ Object
17 18 19 20 21 |
# File 'lib/ruby_learner/pair_timer.rb', line 17 def popup_per_time_for_non_exe(time) popup_file = File.("popup_per_time_for_background.rb", __FILE__) p popup_file system("ruby #{popup_file} #{time} &") end |