Method: ActiveInteraction::Filter.factory

Defined in:
lib/active_interaction/filter.rb

.factory(slug) ⇒ Class

Get the filter associated with a symbol.

Examples:

ActiveInteraction::Filter.factory(:boolean)
# => ActiveInteraction::BooleanFilter
ActiveInteraction::Filter.factory(:invalid)
# => ActiveInteraction::MissingFilterError: :invalid

Parameters:

  • slug (Symbol)

Returns:

  • (Class)

Raises:

See Also:



50
51
52
# File 'lib/active_interaction/filter.rb', line 50

def factory(slug)
  CLASSES.fetch(slug) { raise MissingFilterError, slug.inspect }
end