class Renogen::Formatters::Base
Implements a template pattern that forces the implemention of required methods in sub classes
Attributes
Public Class Methods
# File lib/renogen/formatters/base.rb, line 10 def initialize(options = {}) @options = options end
Adds class with identifier to formatters
@param identifier [String]
# File lib/renogen/formatters/base.rb, line 24 def self.register(identifier) Renogen::Formatters.add(identifier.to_sym, self) end
Public Instance Methods
Generate a header for a given changelog
@param changelog [Renogen::ChangeLog::Model]
return [String]
# File lib/renogen/formatters/base.rb, line 33 def header(changelog) "#{changelog.version} (#{changelog.date})" end
Switch to determine if the formatter is in table format(instead of group format)
return [Boolean] (default: false)
# File lib/renogen/formatters/base.rb, line 17 def table_formatter? false # for backward compatibility end
Outputs a line or block as the body for a change.
@abstract
@param change [String] @raise NotImplementedError
# File lib/renogen/formatters/base.rb, line 67 def write_change(change) raise NotImplementedError end
Outputs a line or block as a header for a group.
@abstract
@param group [String] @raise NotImplementedError
# File lib/renogen/formatters/base.rb, line 52 def write_group(group) end
Outputs a line or block of text appearing after a group.
@return [nil]
# File lib/renogen/formatters/base.rb, line 58 def write_group_end end
Outputs a line or block of text appearing at the top of the change log.
@abstract
@param header [String] @raise NotImplementedError
# File lib/renogen/formatters/base.rb, line 43 def write_header(header) end