Class: Hacer::Todo
- Inherits:
-
Object
- Object
- Hacer::Todo
- Defined in:
- lib/hacer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Text of the todo.
-
#todo_id ⇒ Object
readonly
id of the todo.
Instance Method Summary collapse
-
#completed? ⇒ Boolean
Returns true if this todo has been completed.
-
#initialize ⇒ Todo
constructor
Do not create Todos this way, use the Todolist instead.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Todo
Do not create Todos this way, use the Todolist instead
107 108 109 |
# File 'lib/hacer.rb', line 107 def initialize raise "Use the Todolist to create todos" end |
Instance Attribute Details
#text ⇒ Object (readonly)
Text of the todo
99 100 101 |
# File 'lib/hacer.rb', line 99 def text @text end |
#todo_id ⇒ Object (readonly)
id of the todo
101 102 103 |
# File 'lib/hacer.rb', line 101 def todo_id @todo_id end |
Instance Method Details
#completed? ⇒ Boolean
Returns true if this todo has been completed
104 |
# File 'lib/hacer.rb', line 104 def completed?; @completed; end |
#to_s ⇒ Object
111 112 113 114 115 |
# File 'lib/hacer.rb', line 111 def to_s s = "Todo(#{todo_id},#{text}" s += ",completed" if completed? s + ")" end |