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) ⇒ Object
-
#initialize(options) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(options) ⇒ Formatter
Returns a new instance of Formatter.
10 11 12 |
# File 'lib/hyrum/formats/formatter.rb', line 10 def initialize() @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/hyrum/formats/formatter.rb', line 8 def @options end |
Instance Method Details
#format(messages) ⇒ Object
14 15 16 17 18 |
# File 'lib/hyrum/formats/formatter.rb', line 14 def format() template_file = File.join(__dir__, 'templates', "#{[:format]}.erb") template = ERB.new(File.read(template_file), trim_mode: '-') template.result_with_hash(messages: ) end |