Class: TaskManager::Task
- Inherits:
-
Object
- Object
- TaskManager::Task
- Defined in:
- lib/task_manager/task.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#finished_at ⇒ Object
Returns the value of attribute finished_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#score ⇒ Object
Returns the value of attribute score.
-
#started_at ⇒ Object
Returns the value of attribute started_at.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name = nil, score = nil) ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(name = nil, score = nil) ⇒ Task
Returns a new instance of Task.
12 13 14 15 |
# File 'lib/task_manager/task.rb', line 12 def initialize(name = nil, score = nil) @name = name @score = score end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/task_manager/task.rb', line 5 def created_at @created_at end |
#finished_at ⇒ Object
Returns the value of attribute finished_at.
5 6 7 |
# File 'lib/task_manager/task.rb', line 5 def finished_at @finished_at end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/task_manager/task.rb', line 5 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/task_manager/task.rb', line 5 def name @name end |
#score ⇒ Object
Returns the value of attribute score.
5 6 7 |
# File 'lib/task_manager/task.rb', line 5 def score @score end |
#started_at ⇒ Object
Returns the value of attribute started_at.
5 6 7 |
# File 'lib/task_manager/task.rb', line 5 def started_at @started_at end |
Class Method Details
.new_from_node(node) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/task_manager/task.rb', line 17 def self.new_from_node(node) task = Task.new task.id = node['id'] task.name = node['name'] task.score = node['score'] task.created_at = parse_time(node['created_at']) task.started_at = parse_time(node['started_at']) task.finished_at = parse_time(node['finished_at']) task end |