Module: Tot::Config

Defined in:
lib/tot.rb

Overview

{{{

Constant Summary collapse

@@CONFIG_FILE =
File.join(ENV['HOME'],'.totrc')
@@TODO_PATH =
nil

Class Method Summary collapse

Class Method Details

.createObject



21
22
23
24
25
# File 'lib/tot.rb', line 21

def create
  path = Readline.readline("Input the path to save tasks >> ",false)
  path += ".yaml" unless [".yaml",".yml"].include?(File.extname(path))
  File.open(@@CONFIG_FILE,'w'){|file| YAML.dump({'todo_file' => path}, file)}
end

.todo_pathObject



16
17
18
19
# File 'lib/tot.rb', line 16

def todo_path
  create unless File.exists?(@@CONFIG_FILE)
  @@TODO_PATH = YAML.load_file(@@CONFIG_FILE)['todo_file'] 
end