module Renogen::Formatters
Formatters
to manipulate how the change is output
Also has methods to retrive and add a formatters
Public Class Methods
add(identifier, klass)
click to toggle source
Adds a new formatter class to store
@param identifier [Symbol] @param klass [Symbol]
# File lib/renogen/formatters.rb, line 26 def add(identifier, klass) # raise 'name taken' unless formatters[name].nil? formatters[identifier]=klass end
obtain(format_type, options={})
click to toggle source
Retrieves a formatter from a given key
@param format_type [String] identifier for formatter @param options [Hash] any options required for formatter @return [Formatter::Base]
# File lib/renogen/formatters.rb, line 13 def obtain(format_type, options={}) formatter = formatters[format_type.to_sym] if formatter formatter.new(options) else raise Renogen::Exceptions::StratagyNotFound.new(format_type) end end
Private Class Methods
formatters()
click to toggle source
# File lib/renogen/formatters.rb, line 33 def formatters @formatters ||= {} end