Sha256: 73091d35b35880044b695bc4e1f0f9094bfba1d61c81a3e117a0fc8e5254bae4

Contents?: true

Size: 569 Bytes

Versions: 10

Compression:

Stored size: 569 Bytes

Contents

# frozen_string_literal: true

module ActiveInteraction
  class Base
    def self.import_filters_optionally(klass, options = {})
      only = options[:only]
      except = options[:except]
      default_value = options[:default_value]

      other_filters = klass.filters.dup
      other_filters.select! { |k, _| [*only].include?(k) } if only
      other_filters.reject! { |k, _| [*except].include?(k) } if except

      other_filters.each_value do |filter|
        filter.options[:default] = default_value
        initialize_filter(filter)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mtk_framework-1.0.1 lib/mtk_framework/gem_extensions/active_interaction/base.rb
mtk_framework-1.0.0 lib/mtk_framework/gem_extensions/active_interaction/base.rb
mtk_framework-0.1.7 lib/mtk_framework/gem_extensions/active_interaction/base.rb
mtk_framework-0.1.6 lib/mtk_framework/gem_extensions/active_interaction/base.rb
mtk_framework-0.1.5 lib/mtk_framework/gem_extensions/active_interaction/base.rb
mtk_framework-0.1.4 lib/mtk_framework/gem_extensions/active_interaction/base.rb
mtk_framework-0.1.3 lib/mtk_framework/gem_extensions/active_interaction/base.rb
mtk_framework-0.1.2 lib/mtk_framework/gem_extensions/active_interaction/base.rb
mtk_framework-0.1.1 lib/mtk_framework/gem_extensions/active_interaction/base.rb
mtk_framework-0.1.0 lib/mtk_framework/gem_extensions/active_interaction/base.rb