class Renogen::Formatters::Base

Implements a template pattern that forces the implemention of required methods in sub classes

Attributes

options[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/renogen/formatters/base.rb, line 10
def initialize(options = {})
  @options = options
end
register(identifier) click to toggle source

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

header(changelog) click to toggle source

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
table_formatter?() click to toggle source

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
write_change(change) click to toggle source

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
write_group(group) click to toggle source

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
write_group_end() click to toggle source

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
write_header(header) click to toggle source

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