Object
Superclass for GlobalFilterList and CustomFilterList with filters processing.
List of enable active filters.
# File lib/r18n-core/filter_list.rb, line 83 def active(type) [] end
List of enable filters.
# File lib/r18n-core/filter_list.rb, line 88 def all(type) [] end
Array of enabled filters with filters_type for type.
# File lib/r18n-core/filter_list.rb, line 67 def enabled(filters_type, type) if filters_type == :passive passive(type) elsif filters_type == :active active(type) else all(type) end end
List of enable passive filters.
# File lib/r18n-core/filter_list.rb, line 78 def passive(type) [] end
Process value by filters in enabled.
# File lib/r18n-core/filter_list.rb, line 25 def process(filters_type, type, value, locale, path, params) config = { :locale => locale, :path => path } enabled(filters_type, type).each do |filter| value = filter.call(value, config, *params) end if value.is_a? String value = TranslatedString.new(value, locale, path) process_string(filters_type, value, config, params) else value end end
Process value by global filters in enabled.
# File lib/r18n-core/filter_list.rb, line 51 def process_string(filters_type, value, config, params) if config.is_a? String config = { :locale => value.locale, :path => config } end enabled(filters_type, String).each do |f| value = f.call(value, config, *params) end if value.class == String TranslatedString.new(value, config[:locale], config[:path]) else value end end
Shortcut ot process `R18n::Typed`.
# File lib/r18n-core/filter_list.rb, line 41 def process_typed(filters_type, typed_value, params) process(filters_type, typed_value.type, typed_value.value, typed_value.locale, typed_value.path, params) end
Generated with the Darkfish Rdoc Generator 2.