Class: Tudu::Task

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

Overview

Tudu::Task

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, name) ⇒ Task

init task with setting task type and task name.



12
13
14
# File 'lib/task.rb', line 12

def initialize(type, name)
  @type, @name = type, name
end

Instance Attribute Details

#nameObject

task name [uniq]



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

def name
  @name
end

#typeObject

task type [todo, doing, done]



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

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



28
29
30
31
# File 'lib/task.rb', line 28

def ==(other)
  return true if name == other.name && type == other.type
  false
end

#doing?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/task.rb', line 20

def doing?
  @type == 'doings'
end

#done?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/task.rb', line 24

def done?
  @type == 'dones'
end

#todo?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/task.rb', line 16

def todo?
  @type == 'todos'
end