Class: MicroManager::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/micro_manager/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description:, due:) ⇒ Task

Returns a new instance of Task.



7
8
9
10
11
# File 'lib/micro_manager/task.rb', line 7

def initialize(description:, due:)
  @description = description
  @due = due
  @completed = false
end

Instance Attribute Details

#completed_onObject (readonly)

Returns the value of attribute completed_on.



5
6
7
# File 'lib/micro_manager/task.rb', line 5

def completed_on
  @completed_on
end

#descriptionObject (readonly)

Returns the value of attribute description.



5
6
7
# File 'lib/micro_manager/task.rb', line 5

def description
  @description
end

#dueObject (readonly)

Returns the value of attribute due.



5
6
7
# File 'lib/micro_manager/task.rb', line 5

def due
  @due
end

Instance Method Details

#==(other) ⇒ Object



22
23
24
# File 'lib/micro_manager/task.rb', line 22

def ==(other)
  description == other.description && completed? == other.completed?
end

#completeObject



13
14
15
16
# File 'lib/micro_manager/task.rb', line 13

def complete
  @completed = true
  @completed_on = Date.today
end

#completed?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/micro_manager/task.rb', line 18

def completed?
  @completed
end