Séparation des classes (une par fichier)

This commit is contained in:
Yann Esposito 2009-05-18 11:55:14 +02:00
parent f255701401
commit 76adde2cb3
3 changed files with 57 additions and 55 deletions

41
contact.rb Normal file
View file

@ -0,0 +1,41 @@
#!/usr/bin/env ruby
class Contact
# Contact is mainly an associated array
# with some standard keys such as:
# - name, phone, port, email, address...
# The idea behind this class is to be able
# to show the contact informations along
# with the
DefaultValues=[ "name", "email", "phone", "website",
"address", "url" ]
def initialize (name)
@information["name"]=name;
@information["email"]=[];
@information["phone"]=[];
@information["website"]=[];
@information["url"]=[];
@information["address"]=[];
end
def append_info(key, value)
@information[key].append(value)
end
def add_email (email)
append_info("email",email);
end
def add_phone (phone)
append_info("phone",phone);
end
def add_website(website)
append_info("website",website);
end
def add_url(url)
append_info("url",url);
end
end

16
taskTime.rb Normal file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env ruby
class TaskTime
@creation_date # creation date of the task
@done_date # date at which the task was done
@start_date # date at with the task began (hour,minute,second)
@due_date # due date for the task
@duration # time spend for finish that task
# can be set by the user to be
# different than (@done_date - @start_date)
@max_duration # maximal duration for that task
@min_duration # minimal duration for that task
def initialize()
@creation_date=Time.now
end
end

55
todo.rb
View file

@ -1,60 +1,5 @@
#!/usr/bin/env ruby
class Contact
# Contact is mainly an associated array
# with some standard keys such as:
# - name, phone, port, email, address...
# The idea behind this class is to be able
# to show the contact informations along
# with the
DefaultValues=[ "name", "email", "phone", "website",
"address", "url" ]
def initialize (name)
@information["name"]=name;
@information["email"]=[];
@information["phone"]=[];
@information["website"]=[];
@information["url"]=[];
@information["address"]=[];
end
def append_info(key, value)
@information[key].append(value)
end
def add_email (email)
append_info("email",email);
end
def add_phone (phone)
append_info("phone",phone);
end
def add_website(website)
append_info("website",website);
end
def add_url(url)
append_info("url",url);
end
end
class TaskTime
@creation_date # creation date of the task
@done_date # date at which the task was done
@start_date # date at with the task began (hour,minute,second)
@due_date # due date for the task
@duration # time spend for finish that task
# can be set by the user to be
# different than (@done_date - @start_date)
@max_duration # maximal duration for that task
@min_duration # minimal duration for that task
def initialize()
@creation_date=Time.now
end
end
class Task
def initialize(description, note, contacts,
contexts, projects, dates)