Class: PMD::MyAppDelegate
- Inherits:
-
Object
- Object
- PMD::MyAppDelegate
- Defined in:
- lib/pmd/daemon.rb
Instance Method Summary collapse
- #applicationDidFinishLaunching(notification) ⇒ Object
- #handler(sender) ⇒ Object
-
#initialize ⇒ MyAppDelegate
constructor
declare class variables.
Constructor Details
#initialize ⇒ MyAppDelegate
declare class variables
9 10 11 12 13 14 |
# File 'lib/pmd/daemon.rb', line 9 def initialize @started = false @end_time = nil @paused = false @break = false end |
Instance Method Details
#applicationDidFinishLaunching(notification) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pmd/daemon.rb', line 16 def applicationDidFinishLaunching(notification) = NSMenu.new .initWithTitle "Pomodoro" statusBar = NSStatusBar.systemStatusBar @item = item = statusBar._statusItemWithLength(0, withPriority:2137483647) item.length = 0 item.length = NSVariableStatusItemLength NSTimer.scheduledTimerWithTimeInterval(1.0, target:self, selector: :"handler:", userInfo:nil, repeats:true) start Config.pomodoro_length end |
#handler(sender) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/pmd/daemon.rb', line 27 def handler(sender) # check to see if stop was flagged - this should exit if stop_handler return # check to see if a restart was flagged elsif restart_handler return # check to see if a pause was flagged elsif pause_handler return else # normal run update end end |