Class: Text::Gen::Filter::Locale

Inherits:
Base
  • Object
show all
Defined in:
lib/text/gen/filter/locale.rb

Overview

Locale if the key on the filter matches a meta key, then the value of the key becomes a replacement item

For example if a filter with the type and key of “locale:en” were run against an item with segments of ‘[“gracias”]` but with a meta value of `[“thanks”, “thank you”]` then a new item would replace the existing item with a randomly selected segment from the meta.

Instance Method Summary collapse

Methods inherited from Base

#component_key, filter_key, filter_name, #initialize, #key, #to_s, #type, #value

Constructor Details

This class inherits a constructor from Text::Gen::Filter::Base

Instance Method Details

#items(_context, items) ⇒ Object



14
15
16
# File 'lib/text/gen/filter/locale.rb', line 14

def items(_context, items)
  items.map { |item| locale_item(item) || item }
end