Class: HustleAndFlow::Formatters::IssueTableFormatter

Inherits:
Object
  • Object
show all
Includes:
Utils::String
Defined in:
lib/hustle_and_flow/formatters/issue_table_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::String

#titleize, #underscore

Constructor Details

#initialize(issues) ⇒ IssueTableFormatter



11
12
13
# File 'lib/hustle_and_flow/formatters/issue_table_formatter.rb', line 11

def initialize(issues)
  self.issues = issues
end

Instance Attribute Details

#issuesObject

Returns the value of attribute issues.



8
9
10
# File 'lib/hustle_and_flow/formatters/issue_table_formatter.rb', line 8

def issues
  @issues
end

#titleObject

Returns the value of attribute title.



8
9
10
# File 'lib/hustle_and_flow/formatters/issue_table_formatter.rb', line 8

def title
  @title
end

Instance Method Details

#to_aryObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/hustle_and_flow/formatters/issue_table_formatter.rb', line 15

def to_ary
  issues.map do |issue|
    [
      {
        format: number_formatting(issue),
        value:  "##{issue.number}",
      },
      {
        format: contact_formatting(issue),
        value:  issue.contact,
      },
      {
        format: category_formatting(issue),
        value:  titleize(issue.category),
      },
      {
        format: title_formatting(issue),
        value:  issue.title,
      },
    ]
  end
end