Class: ActiveInteraction::HashFilter

Inherits:
Filter
  • Object
show all
Includes:
Missable
Defined in:
lib/active_interaction/filters/hash_filter.rb

Instance Attribute Summary

Attributes inherited from Filter

#filters, #name, #options

Method Summary

Methods inherited from Filter

#clean, #database_column_type, #default, #default?, #desc, factory, #initialize

Constructor Details

This class inherits a constructor from ActiveInteraction::Filter

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object (private)

rubocop:disable Style/MissingRespondToMissing



67
68
69
70
71
72
73
74
75
# File 'lib/active_interaction/filters/hash_filter.rb', line 67

def method_missing(*args, &block)
  super(*args) do |klass, names, options|
    raise InvalidFilterError, 'missing attribute name' if names.empty?

    names.each do |name|
      filters[name] = klass.new(name, options, &block)
    end
  end
end