Class: TaskWarrior::Project
- Inherits:
-
Object
- Object
- TaskWarrior::Project
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/taskwarrior/project.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#tasks ⇒ Object
readonly
Returns the value of attribute tasks.
Instance Method Summary collapse
- #<<(task) ⇒ Object
-
#initialize(name, tasks = []) ⇒ Project
constructor
A new instance of Project.
- #to_s ⇒ Object
Constructor Details
#initialize(name, tasks = []) ⇒ Project
Returns a new instance of Project.
11 12 13 14 15 |
# File 'lib/taskwarrior/project.rb', line 11 def initialize(name, tasks = []) @name = name @tasks = tasks @tasks.each{|t| t.project = self} end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/taskwarrior/project.rb', line 5 def name @name end |
#tasks ⇒ Object (readonly)
Returns the value of attribute tasks.
5 6 7 |
# File 'lib/taskwarrior/project.rb', line 5 def tasks @tasks end |
Instance Method Details
#<<(task) ⇒ Object
17 18 19 20 |
# File 'lib/taskwarrior/project.rb', line 17 def <<(task) @tasks << task task.project = self end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/taskwarrior/project.rb', line 22 def to_s "Project #{name} (#{@tasks.size} tasks)" end |