Class: Lazylead::Task::Teammate

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/lazylead/task/loading.rb

Overview

The teammate’s tickets.

Instance Method Summary collapse

Constructor Details

#initialize(user, tasks = []) ⇒ Teammate

Returns a new instance of Teammate.



57
58
59
60
# File 'lib/lazylead/task/loading.rb', line 57

def initialize(user, tasks = [])
  @user = user
  @tasks = tasks
end

Instance Method Details

#free?Boolean

Returns:

  • (Boolean)


62
63
64
65
# File 'lib/lazylead/task/loading.rb', line 62

def free?
  return true if @tasks.nil?
  @tasks.empty?
end

#nextObject



67
68
69
# File 'lib/lazylead/task/loading.rb', line 67

def next
  @tasks.reject { |t| t.duedate.nil? }.map { |t| t.duedate.to_date }.min
end

#sprints(*label) ⇒ Object



75
76
77
78
# File 'lib/lazylead/task/loading.rb', line 75

def sprints(*label)
  return @tasks.group_by(&:sprint).sort if label.empty? || label.nil?
  @tasks.group_by { |t| t.sprint(label) }.sort
end

#to_sObject



71
72
73
# File 'lib/lazylead/task/loading.rb', line 71

def to_s
  "#{id} has #{total} tasks"
end