Class: Bundleup::PinReport

Inherits:
Report
  • Object
show all
Defined in:
lib/bundleup/pin_report.rb

Instance Method Summary collapse

Methods inherited from Report

#many?, #to_s

Constructor Details

#initialize(gem_versions:, outdated_gems:, gem_comments:) ⇒ PinReport

Returns a new instance of PinReport.


3
4
5
6
7
8
# File 'lib/bundleup/pin_report.rb', line 3

def initialize(gem_versions:, outdated_gems:, gem_comments:)
  super()
  @gem_versions = gem_versions
  @outdated_gems = outdated_gems
  @gem_comments = gem_comments
end

Instance Method Details

#pinned_gemsObject


27
28
29
# File 'lib/bundleup/pin_report.rb', line 27

def pinned_gems
  outdated_gems.keys.sort
end

#rowsObject


16
17
18
19
20
21
22
23
24
25
# File 'lib/bundleup/pin_report.rb', line 16

def rows
  outdated_gems.keys.sort.map do |gem|
    meta = outdated_gems[gem]
    current_version = gem_versions[gem]
    newest_version = meta[:newest]
    pin = meta[:pin]

    [gem, current_version, "", newest_version, *pin_reason(gem, pin)]
  end
end

#titleObject


10
11
12
13
14
# File 'lib/bundleup/pin_report.rb', line 10

def title
  return "Note that this gem is being held back:" if rows.count == 1

  "Note that the following gems are being held back:"
end