Class: Roebe::Shell::Todo

Inherits:
Object show all
Defined in:
lib/roebe/shell/standalone_classes/todo.rb

Constant Summary collapse

FINISH_WITH_THIS_STRING =
#

FINISH_WITH_THIS_STRING

#
'q'
BASE_DIR =
#

BASE_DIR

#
'/home/x/data/personal/todo/'

Instance Method Summary collapse

Constructor Details

#initialize(run_already = true) ⇒ Todo

#

initialize

#


39
40
41
42
43
44
# File 'lib/roebe/shell/standalone_classes/todo.rb', line 39

def initialize(
    run_already = true
  )
  reset
  run if run_already
end

Instance Method Details

#find_out_to_which_todo_we_should_add(base_dir = BASE_DIR) ⇒ Object

#

find_out_to_which_todo_we_should_add

#


59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/roebe/shell/standalone_classes/todo.rb', line 59

def find_out_to_which_todo_we_should_add(
    base_dir = BASE_DIR
  )
  @array_available_todos = Dir["#{base_dir}*"]
  cliner {
    e 'To which Todo-file should we append?'
  }
  @array_available_todos.each_with_index { |content, index|
    content = ": #{content}"
    index = ('%4s' % index)
    e ::Colours.simp(index)+content
  }
end

#get_normal_user_inputObject

#

get_user_input

This method fetches the user input.

#


78
79
80
81
82
83
84
# File 'lib/roebe/shell/standalone_classes/todo.rb', line 78

def get_normal_user_input
  loop {
    input = $stdin.gets
    @complete_user_input << input
    break if input.chomp.downcase == 'q'
  }
end

#resetObject

#

reset

#


49
50
51
52
53
54
# File 'lib/roebe/shell/standalone_classes/todo.rb', line 49

def reset
  # ======================================================================= #
  # === @complete_user_input
  # ======================================================================= #
  @complete_user_input = ''.dup
end

#runObject

#

run

#


89
90
91
92
93
94
# File 'lib/roebe/shell/standalone_classes/todo.rb', line 89

def run
  e "Enter what we should append next (Finish with "\
    "#{FINISH_WITH_THIS_STRING}):"
  get_normal_user_input
  find_out_to_which_todo_we_should_add
end