Class: I18n::Transformers::Collection::Generic

Inherits:
Base
  • Object
show all
Defined in:
lib/i18n/transformers/collection/generic.rb

Instance Method Summary collapse

Methods inherited from Base

#name

Constructor Details

#initialize(name: nil, **options, &block) ⇒ Generic

Returns a new instance of Generic.

Raises:

  • (ArgumentError)


5
6
7
8
9
# File 'lib/i18n/transformers/collection/generic.rb', line 5

def initialize(name: nil, **options, &block)
  super options, &block
  @name = name ? name.to_s : to_s
  raise ArgumentError, 'block is missing' unless @block
end

Instance Method Details

#transform(key, value) ⇒ Object



11
12
13
# File 'lib/i18n/transformers/collection/generic.rb', line 11

def transform(key, value)
  @block.call(key, value)
end