Class: Serega::SeregaPlugins::Formatters::FormattersConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/serega/plugins/formatters/formatters.rb

Overview

Formatters plugin config

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Object

Initializes formatters config object

Parameters:

  • opts (Hash)

    options



103
104
105
# File 'lib/serega/plugins/formatters/formatters.rb', line 103

def initialize(opts)
  @opts = opts
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



95
96
97
# File 'lib/serega/plugins/formatters/formatters.rb', line 95

def opts
  @opts
end

Instance Method Details

#add(formatters) ⇒ void

This method returns an undefined value.

Adds new formatters

Parameters:

  • formatters (Hash<Symbol, #call>)

    hash key is a formatter name and hash value is a callable instance to format value



113
114
115
116
117
118
# File 'lib/serega/plugins/formatters/formatters.rb', line 113

def add(formatters)
  formatters.each_pair do |key, value|
    CheckFormatter.call(key, value)
    opts[key] = value
  end
end