Class: Jirify::UI::SprintTable

Inherits:
Object
  • Object
show all
Defined in:
lib/jirify/ui/sprint_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(issues) ⇒ SprintTable

Returns a new instance of SprintTable.



7
8
9
# File 'lib/jirify/ui/sprint_table.rb', line 7

def initialize(issues)
  @issues = issues
end

Instance Attribute Details

#issuesObject (readonly)

Returns the value of attribute issues.



6
7
8
# File 'lib/jirify/ui/sprint_table.rb', line 6

def issues
  @issues
end

Instance Method Details

#to_table(options) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jirify/ui/sprint_table.rb', line 11

def to_table(options)
  return '' if issues.empty?

  # group issues by status name
  grouped_issues = issues.group_by do |issue|
    options[:all_columns] ? issue.status.name : issue.status.statusCategory['name']
  end

  Terminal::Table.new(
    headings: headings(grouped_issues),
    rows: issues_as_rows(grouped_issues.values, options),
    style: table_style
  )
end