Class: BrewOutdatedFormatter::Formatter
- Inherits:
-
Object
- Object
- BrewOutdatedFormatter::Formatter
- Defined in:
- lib/brew_outdated_formatter/formatter.rb
Overview
Formatter for all formats
Direct Known Subclasses
CSVFormatter, HTMLFormatter, JSONFormatter, MarkdownFormatter, TSVFormatter, TerminalFormatter, XMLFormatter, YAMLFormatter
Constant Summary collapse
- FORMULA_REGEXP =
/\A(?<formula>.+) \(/
- INSTALLED_REGEXP =
/\((?<installed>.+)\)/
- CURRENT_REGEXP =
/< ((?<current>.+) \[|(?<current>.+)\z)/
- PINNED_REGEXP =
/\[pinned at (?<pinned>.+)\]/
- COLUMNS =
%w[formula installed current pinned].freeze
Instance Method Summary collapse
-
#initialize(options) ⇒ Formatter
constructor
A new instance of Formatter.
- #read_stdin ⇒ Object
Constructor Details
#initialize(options) ⇒ Formatter
Returns a new instance of Formatter.
11 12 13 14 |
# File 'lib/brew_outdated_formatter/formatter.rb', line 11 def initialize() @pretty = [:pretty] @outdated_formulas = [] end |
Instance Method Details
#read_stdin ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/brew_outdated_formatter/formatter.rb', line 16 def read_stdin @outdated_formulas = STDIN.each.to_a.map(&:strip).reject(&:empty?) @outdated_formulas.map! do |line| find_formula(line) end @outdated_formulas.compact! end |