Class: Report

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

Overview

This class builds entire report based on issues and pull requests passed.

Instance Method Summary collapse

Constructor Details

#initialize(user, position, title, additional: ReportItems.new([], [])) ⇒ Report

Returns a new instance of Report.



26
27
28
29
30
31
# File 'lib/newsman/report.rb', line 26

def initialize(user, position, title, additional: ReportItems.new([], []))
  @user = user
  @position = position
  @title = title
  @additional = additional
end

Instance Method Details

#append_additional(report) ⇒ Object



56
57
58
# File 'lib/newsman/report.rb', line 56

def append_additional(report)
  "#{report}\n#{"------\n#{@additional}" unless @additional.empty?}"
end

#build(achievements, plans, risks, date) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/newsman/report.rb', line 33

def build(achievements, plans, risks, date)
  <<~TEMPLATE
    From: #{@user}
    Subject: #{week_of_a_year(@title, date)}

    Hi all,

    Last week achievements:
    #{achievements}

    Next week plans:
    #{plans}

    Risks:
    #{risks}

    Best regards,
    #{@user}
    #{@position}
    #{date}
  TEMPLATE
end