Module: Todo::Helpers::Tasks
Overview
Helper methods used in the Todo::Tasks module
Instance Method Summary collapse
-
#update_task(is_num, names, task, key, value) ⇒ Object
Update a task.
Instance Method Details
#update_task(is_num, names, task, key, value) ⇒ Object
Update a task
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/to-do/helpers/helpers_tasks.rb', line 15 def update_task is_num, names, task, key, value if is_num found_task = names[:Task_number => task] if found_task Helpers::DATABASE[:Tasks].filter(:Id => found_task[:Id]).update(key => value) else puts "Task ##{task} is not in the list." end else found_task = names.with_sql("SELECT * FROM :table WHERE Name = :task COLLATE NOCASE",:table=>names, :task=>task).first if found_task Helpers::DATABASE[:Tasks].filter(:Id => found_task[:Id]).update(key => value) else puts "Task '#{task}' is not in the list." end end end |