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



98
99
100
# File 'lib/serega/plugins/formatters/formatters.rb', line 98

def initialize(opts)
  @opts = opts
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



90
91
92
# File 'lib/serega/plugins/formatters/formatters.rb', line 90

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



108
109
110
111
112
# File 'lib/serega/plugins/formatters/formatters.rb', line 108

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