Premiers ajouts. Synchro pour retour maison.
Ajout de la récupération d'une tâche à partir d'une 'raw_input' à la ikog. Il manque encore la récupération de toutes les infos 'raw_input' pour les taskTime. Ajout d'une classe qui correspond à la todolist. Ici pas grand chose, juste un tableau.
This commit is contained in:
parent
9c8a8cf17a
commit
a70146a93c
2 changed files with 30 additions and 0 deletions
20
task.rb
20
task.rb
|
@ -1,4 +1,7 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
#
|
||||||
|
require 'taskTime.rb'
|
||||||
|
require 'contact.rb'
|
||||||
|
|
||||||
class Task
|
class Task
|
||||||
def initialize(description, note, contacts,
|
def initialize(description, note, contacts,
|
||||||
|
@ -25,4 +28,21 @@ class Task
|
||||||
@projects=[]
|
@projects=[]
|
||||||
@dates=TaskTime.new()
|
@dates=TaskTime.new()
|
||||||
end
|
end
|
||||||
|
def to_s
|
||||||
|
return @description +
|
||||||
|
@contexts.map { |x| x.to_s }.join " " +
|
||||||
|
@projects.map { |x| x.to_s }.join " " +
|
||||||
|
@contacts.map { |x| x.to_s }.join " " +
|
||||||
|
@dates.to_s
|
||||||
|
end
|
||||||
|
def task_from_string( raw_input )
|
||||||
|
# petite difficulté pour retrouver le message dans toute cette Meumeu...
|
||||||
|
@description = raw_input
|
||||||
|
@description raw_input.gsub(/ (@|(p|project|c|contact|n|note):)(\w+|"[^"]*")/,"")
|
||||||
|
@contexts=raw.scan(/ @(\w+|"[^"]*")/).map{ |x| x[0] }
|
||||||
|
@projects=raw.scan(/ (p|project):(\w+|"[^"]*")/).map{ |x| x[1] }
|
||||||
|
@contacts=raw.scan(/ (c|contact):(\w+|"[^"]*")/).map{ |x| x[1] }
|
||||||
|
@notes =raw.scan(/ (n|note):(\w+|"[^"]*")/).map{ |x| x[1] }
|
||||||
|
@dates =TaskTime.date_from_string(raw_input)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
10
todolist.rb
Normal file
10
todolist.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
class TodoList
|
||||||
|
def initialize()
|
||||||
|
@todoList=[]
|
||||||
|
end
|
||||||
|
def addTask(task)
|
||||||
|
@todoList.append(task)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue