Class: TodoModel
- Inherits:
-
Object
- Object
- TodoModel
- Defined in:
- lib/todo_model.rb
Overview
Model of the Todo entity
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #as_hash ⇒ Object
- #complete ⇒ Object
-
#initialize(id, description, status = :pending) ⇒ TodoModel
constructor
A new instance of TodoModel.
Constructor Details
#initialize(id, description, status = :pending) ⇒ TodoModel
Returns a new instance of TodoModel.
9 10 11 12 13 |
# File 'lib/todo_model.rb', line 9 def initialize(id, description, status = :pending) @id = id @description = description @status = status end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/todo_model.rb', line 6 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/todo_model.rb', line 5 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/todo_model.rb', line 7 def status @status end |
Instance Method Details
#as_hash ⇒ Object
19 20 21 |
# File 'lib/todo_model.rb', line 19 def as_hash { 'id': id, 'description': description, 'status': status } end |
#complete ⇒ Object
15 16 17 |
# File 'lib/todo_model.rb', line 15 def complete @status = :completed end |