Class: I18nFlow::CLI::LintCommand::MarkdownRenderer
- Inherits:
-
Object
- Object
- I18nFlow::CLI::LintCommand::MarkdownRenderer
- Defined in:
- lib/i18n_flow/cli/lint_command/markdown_renderer.rb
Constant Summary collapse
- FILE =
__dir__ + '/markdown.erb'
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#url_formatter ⇒ Object
readonly
Returns the value of attribute url_formatter.
Instance Method Summary collapse
- #error_count ⇒ Object
- #file_count ⇒ Object
-
#initialize(errors, url_formatter:) ⇒ MarkdownRenderer
constructor
A new instance of MarkdownRenderer.
- #render ⇒ Object
- #summary_line ⇒ Object
Constructor Details
#initialize(errors, url_formatter:) ⇒ MarkdownRenderer
Returns a new instance of MarkdownRenderer.
11 12 13 14 |
# File 'lib/i18n_flow/cli/lint_command/markdown_renderer.rb', line 11 def initialize(errors, url_formatter:) @errors = errors @url_formatter = url_formatter end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/i18n_flow/cli/lint_command/markdown_renderer.rb', line 8 def errors @errors end |
#url_formatter ⇒ Object (readonly)
Returns the value of attribute url_formatter.
9 10 11 |
# File 'lib/i18n_flow/cli/lint_command/markdown_renderer.rb', line 9 def url_formatter @url_formatter end |
Instance Method Details
#error_count ⇒ Object
24 25 26 |
# File 'lib/i18n_flow/cli/lint_command/markdown_renderer.rb', line 24 def error_count @error_count ||= errors.sum { |_, errs| errs.size } end |
#file_count ⇒ Object
20 21 22 |
# File 'lib/i18n_flow/cli/lint_command/markdown_renderer.rb', line 20 def file_count @file_count ||= errors.size end |
#render ⇒ Object
16 17 18 |
# File 'lib/i18n_flow/cli/lint_command/markdown_renderer.rb', line 16 def render with_link(erb.result(binding)) end |
#summary_line ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/i18n_flow/cli/lint_command/markdown_renderer.rb', line 28 def summary_line @summary_line ||= 'Found %d %s in %d %s' % [ error_count, error_count == 1 ? 'violation' : 'violations', file_count, file_count == 1 ? 'file' : 'files', ] end |