Class: Todo
- Inherits:
-
Object
- Object
- Todo
- Defined in:
- lib/todo.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#finished_at ⇒ Object
Returns the value of attribute finished_at.
-
#status ⇒ Object
Returns the value of attribute status.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(description) ⇒ Todo
constructor
A new instance of Todo.
Constructor Details
#initialize(description) ⇒ Todo
Returns a new instance of Todo.
7 8 9 10 11 |
# File 'lib/todo.rb', line 7 def initialize(description) @description = description @status = :pending @tags = [] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/todo.rb', line 4 def description @description end |
#finished_at ⇒ Object
Returns the value of attribute finished_at.
5 6 7 |
# File 'lib/todo.rb', line 5 def finished_at @finished_at end |
#status ⇒ Object
Returns the value of attribute status.
5 6 7 |
# File 'lib/todo.rb', line 5 def status @status end |
#tags ⇒ Object
Returns the value of attribute tags.
5 6 7 |
# File 'lib/todo.rb', line 5 def @tags end |
Instance Method Details
#id ⇒ Object
13 14 15 16 17 |
# File 'lib/todo.rb', line 13 def id description_hash = OpenSSL::Digest::SHA1.new(@description) description_hash = description_hash.hexdigest description_hash.slice(0..5) end |