Class: Ilpomodoro

Inherits:
Object
  • 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

#initializeIlpomodoro

Returns a new instance of Ilpomodoro.



4
5
6
# File 'lib/ilpomodoro.rb', line 4

def initialize
  @h = HighLine.new
end

Instance Attribute Details

#taskObject (readonly)

Returns the value of attribute task.



2
3
4
# File 'lib/ilpomodoro.rb', line 2

def task
  @task
end

Instance Method Details

#get_taskObject



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.
    tracker.story
end
end

#startObject



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?
      #tracker.close(task)
      # history.close(task)
    else
      #tracker.close(task)
      # history.wip(task)
    end
    take_a_break
  end
end

#wants_to_commit?Boolean

Returns:

  • (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

Returns:

  • (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

Returns:

  • (Boolean)


8
9
10
# File 'lib/ilpomodoro.rb', line 8

def work_offline?
  @work_offline ||= @h.agree('do you want to work offline?')
end