Class: BrewOutdatedFormatter::MarkdownFormatter

Inherits:
Formatter
  • Object
show all
Defined in:
lib/brew_outdated_formatter/formatter/markdown_formatter.rb

Overview

Formatter for Markdown

Constant Summary collapse

HEADER =
<<-EOS.freeze
| formula | installed | current | pinned |
| --- | --- | --- | --- |
EOS

Constants inherited from Formatter

Formatter::COLUMNS, Formatter::CURRENT_REGEXP, Formatter::FORMULA_REGEXP, Formatter::INSTALLED_REGEXP, Formatter::PINNED_REGEXP

Instance Method Summary collapse

Methods inherited from Formatter

#initialize, #read_stdin

Constructor Details

This class inherits a constructor from BrewOutdatedFormatter::Formatter

Instance Method Details

#convertObject



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

def convert
  @outdated_formulas.map! do |formula|
    "| #{formula.values.join(' | ')} |".gsub(/  /, ' ')
  end

  (HEADER + @outdated_formulas.join("\n")).chomp
end