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>.+) \(/.freeze
NEWEST_REGEXP =
/newest (?<newest>[\d.]+)/.freeze
INSTALLED_REGEXP =
/installed (?<installed>[\d.]+)/.freeze
REQUESTED_REGEXP =
/requested (?<requested>.+)\)/.freeze
GROUPS_REGEXP =
/in groups? "(?<groups>.+)"/.freeze

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Formatter

Returns a new instance of Formatter.



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

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

Instance Method Details

#read_stdinObject



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

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