Class: Hyrum::Formats::Formatter
- Inherits:
-
Object
- Object
- Hyrum::Formats::Formatter
- Defined in:
- lib/hyrum/formats/formatter.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #format(messages, validation_result = nil) ⇒ Object
-
#initialize(options) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(options) ⇒ Formatter
Returns a new instance of Formatter.
12 13 14 |
# File 'lib/hyrum/formats/formatter.rb', line 12 def initialize() @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/hyrum/formats/formatter.rb', line 10 def @options end |
Instance Method Details
#format(messages, validation_result = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/hyrum/formats/formatter.rb', line 16 def format(, validation_result = nil) template_file = File.join(__dir__, 'templates', "#{[:format]}.erb") template = ERB.new(File.read(template_file), trim_mode: '-') template.result_with_hash( messages: , validation_result: validation_result, show_scores: [:show_scores] ) end |