Class: Versed::Task

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(category_id, date) ⇒ Task

Returns a new instance of Task.



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

def initialize(category_id, date)
  @category_id = category_id
  @date = date
end

Instance Attribute Details

#category_idObject

Returns the value of attribute category_id.



3
4
5
# File 'lib/versed/task.rb', line 3

def category_id
  @category_id
end

#dateObject

Returns the value of attribute date.



3
4
5
# File 'lib/versed/task.rb', line 3

def date
  @date
end

#time_scheduledObject

Returns the value of attribute time_scheduled.



3
4
5
# File 'lib/versed/task.rb', line 3

def time_scheduled
  @time_scheduled
end

#time_spentObject

Returns the value of attribute time_spent.



3
4
5
# File 'lib/versed/task.rb', line 3

def time_spent
  @time_spent
end

Instance Method Details

#time_scheduled?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/versed/task.rb', line 30

def time_scheduled?
  self.time_scheduled && self.time_scheduled > 0
end

#time_spent?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/versed/task.rb', line 26

def time_spent?
  self.time_spent && self.time_spent > 0
end

#to_hashObject



10
11
12
13
14
15
16
# File 'lib/versed/task.rb', line 10

def to_hash
  {
    "time_spent" => self.time_spent.to_s,
    "time_scheduled" => self.time_scheduled.to_s,
    "style" => style
  }
end