Class: I18n::Transformers::Collection::Generic
- Defined in:
- lib/i18n/transformers/collection/generic.rb
Instance Method Summary collapse
-
#initialize(name: nil, **options, &block) ⇒ Generic
constructor
A new instance of Generic.
- #transform(key, value) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(name: nil, **options, &block) ⇒ Generic
Returns a new instance of Generic.
5 6 7 8 9 |
# File 'lib/i18n/transformers/collection/generic.rb', line 5 def initialize(name: nil, **, &block) super , &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 |