Class: EnvLint::Formatter
- Inherits:
-
Object
- Object
- EnvLint::Formatter
- Defined in:
- lib/env_lint/formatter.rb
Instance Method Summary collapse
- #error(message) ⇒ Object
-
#initialize(out = Formatador) ⇒ Formatter
constructor
A new instance of Formatter.
- #missing_variables(dot_env_file, variables) ⇒ Object
- #ok(message) ⇒ Object
- #unknown_variables(dot_env_file, variable_names) ⇒ Object
Constructor Details
#initialize(out = Formatador) ⇒ Formatter
Returns a new instance of Formatter.
5 6 7 |
# File 'lib/env_lint/formatter.rb', line 5 def initialize(out = Formatador) @out = out end |
Instance Method Details
#error(message) ⇒ Object
31 32 33 |
# File 'lib/env_lint/formatter.rb', line 31 def error() @out.display_line("* [red]#{}[/]") end |
#missing_variables(dot_env_file, variables) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/env_lint/formatter.rb', line 9 def missing_variables(dot_env_file, variables) error("Missing env variables:\n") variables.each do |variable| @out.display_line(" [yellow]#{variable.name}[/] - #{variable.comment}") end new_line info("Either set the variable or make it optional in the #{dot_env_file.name} file.") end |
#ok(message) ⇒ Object
35 36 37 |
# File 'lib/env_lint/formatter.rb', line 35 def ok() @out.display_line("* [green]#{}[/]") end |
#unknown_variables(dot_env_file, variable_names) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/env_lint/formatter.rb', line 20 def unknown_variables(dot_env_file, variable_names) error("Unknown env variables:\n") variable_names.each do |name| @out.display_line(" [yellow]#{name}[/]") end new_line info("Only variables descibred in #{dot_env_file.name} can be used.") end |