Class: Ilpomodoro
- Inherits:
-
Object
show all
- Defined in:
- lib/ilpomodoro.rb
Defined Under Namespace
Classes: History, PivotalTracker, Timer
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Ilpomodoro.
4
5
6
|
# File 'lib/ilpomodoro.rb', line 4
def initialize
@h = HighLine.new
end
|
Instance Attribute Details
#task ⇒ Object
Returns the value of attribute task.
2
3
4
|
# File 'lib/ilpomodoro.rb', line 2
def task
@task
end
|
Instance Method Details
#get_task ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/ilpomodoro.rb', line 12
def get_task
if work_offline?
@h.ask 'i will be working on...'
else
tracker.login
tracker.story
end
end
|
#start ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/ilpomodoro.rb', line 21
def start
loop do
task = get_task
do_a_pomodoro
if finished?(task)
git.commit(task) if was_doing_code? and wants_to_commit?
else
end
take_a_break
end
end
|
#wants_to_commit? ⇒ Boolean
42
43
44
|
# File 'lib/ilpomodoro.rb', line 42
def wants_to_commit?
agree("do you want to commit?(y/n)")
end
|
#was_doing_code? ⇒ Boolean
38
39
40
|
# File 'lib/ilpomodoro.rb', line 38
def was_doing_code?
agree("have you been doing code?(y/n)")
end
|
#work_offline? ⇒ Boolean
8
9
10
|
# File 'lib/ilpomodoro.rb', line 8
def work_offline?
@work_offline ||= @h.agree('do you want to work offline?')
end
|