Class: BulletJournal::Task
- Inherits:
-
Object
- Object
- BulletJournal::Task
- Defined in:
- lib/bullit/task.rb
Instance Attribute Summary collapse
-
#complete ⇒ Object
Returns the value of attribute complete.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text:, complete: false, created_at: Time.now) ⇒ Task
constructor
A new instance of Task.
- #mark_as_complete ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(text:, complete: false, created_at: Time.now) ⇒ Task
Returns a new instance of Task.
5 6 7 8 9 |
# File 'lib/bullit/task.rb', line 5 def initialize(text:, complete: false, created_at: Time.now) @text = text @complete = complete @created_at = created_at end |
Instance Attribute Details
#complete ⇒ Object
Returns the value of attribute complete.
3 4 5 |
# File 'lib/bullit/task.rb', line 3 def complete @complete end |
#text ⇒ Object
Returns the value of attribute text.
3 4 5 |
# File 'lib/bullit/task.rb', line 3 def text @text end |
Instance Method Details
#mark_as_complete ⇒ Object
19 20 21 22 |
# File 'lib/bullit/task.rb', line 19 def mark_as_complete @complete = true to_h end |
#to_h ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/bullit/task.rb', line 11 def to_h { text: text, complete: complete, created_at: Time.now.to_s } end |