class ActiveInteraction::HashFilter
Public Instance Methods
import_filters(klass, options = {})
click to toggle source
Import filters from another interaction.
@param klass [Class] The other interaction. @param options [Hash]
@option options [Array<Symbol>, nil] :only Import only these filters. @option options [Array<Symbol>, nil] :except Import all filters except
for these.
@!visibility public
# File lib/mtk_framework/gem_extensions/active_interaction/filters/hash_filter.rb, line 23 def import_filters(klass, options = {}) # rubocop:disable Metrics/AbcSize only = options[:only] except = options[:except] groups = options[:groups] || [klass.to_s.demodulize.underscore.to_sym] klass.filters.each do |name, filter| next if only && ![*only].include?(name) next if except && [*except].include?(name) options = filter.options.merge(groups: groups) filter_copy = filter.class.new(name, options) filters[name] = filter_copy end end