Class: DoWorkScreen

Inherits:
Screen show all
Defined in:
lib/kale/ui.rb

Instance Method Summary collapse

Constructor Details

#initializeDoWorkScreen

Returns a new instance of DoWorkScreen.



164
165
166
167
# File 'lib/kale/ui.rb', line 164

def initialize
  @session = Session.new
  super
end

Instance Method Details

#handle_menuObject



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/kale/ui.rb', line 179

def handle_menu
  answer = gets.chomp

  if answer == "1"
    puts "Enter a description for the work you just completed."
    description = gets.chomp
    @session.stop({ :description => description, :project => @@project })
    system "clear"
    puts "You worked for #{seconds_to_hms(@session.elapsed_time)} on \"#{@session.description}\" and earned #{@session.earned}"
    sleep(4)

    ShowProjectScreen.new
  elsif answer == "2"
    # TODO put in check to verify user wants to discard work
    ShowProjectScreen.new
  end
end

#infoObject



169
170
171
# File 'lib/kale/ui.rb', line 169

def info
  show_project_heading
end


173
174
175
176
177
# File 'lib/kale/ui.rb', line 173

def menu
  @menu.push "Stop Working"
  @menu.push "Do not record this work."
  super
end