Class: BundleOutdatedFormatter::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/bundle_outdated_formatter/formatter.rb

Overview

Formatter for all formats

Constant Summary collapse

GEM_REGEXP =
/\A\* (?<gem>.+) \(/
NEWEST_REGEXP =
/newest (?<newest>[\d\.]+)/
INSTALLED_REGEXP =
/installed (?<installed>[\d\.]+)/
REQUESTED_REGEXP =
/requested (?<requested>.+)\)/
GROUPS_REGEXP =
/in groups "(?<groups>.+)"/
COLUMNS =
%w[gem newest installed requested groups].freeze

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Formatter

Returns a new instance of Formatter.



14
15
16
17
18
# File 'lib/bundle_outdated_formatter/formatter.rb', line 14

def initialize(options)
  @pretty = options[:pretty]
  @style = options[:style]
  @outdated_gems = []
end

Instance Method Details

#read_stdinObject



20
21
22
23
24
25
26
27
28
# File 'lib/bundle_outdated_formatter/formatter.rb', line 20

def read_stdin
  @outdated_gems = STDIN.each.to_a.map(&:strip).reject(&:empty?)

  @outdated_gems.map! do |line|
    find_gem(line)
  end

  @outdated_gems.compact!
end