class Bundleup::PinReport

Attributes

gem_comments[R]
gem_versions[R]
outdated_gems[R]

Public Class Methods

new(gem_versions:, outdated_gems:, gem_comments:) click to toggle source
Calls superclass method
# 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

Public Instance Methods

rows() click to toggle source
# 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
title() click to toggle source
# 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

Private Instance Methods

pin_reason(gem, pin) click to toggle source
# File lib/bundleup/pin_report.rb, line 31
def pin_reason(gem, pin)
  notes = Colors.gray(gem_comments[gem].to_s)
  pin_operator, pin_version = pin.split(" ", 2)
  [":", "pinned at", pin_operator.rjust(2), pin_version, notes]
end