Class: ActiveInteraction::Filter::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/active_interaction/filter/error.rb

Overview

A validation error that occurs while processing the filter.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filter, type, name: nil) ⇒ Error

Returns a new instance of Error.



10
11
12
13
14
15
16
17
# File 'lib/active_interaction/filter/error.rb', line 10

def initialize(filter, type, name: nil)
  @filter = filter
  @name = name || filter.name
  @type = type

  @options = {}
  options[:type] = I18n.translate("#{Base.i18n_scope}.types.#{filter.class.slug}") if type == :invalid_type
end

Instance Attribute Details

#filterActiveInteraction::Filter (readonly)

The filter the error occured on.



22
23
24
# File 'lib/active_interaction/filter/error.rb', line 22

def filter
  @filter
end

#nameSymbol (readonly)

The name of the error.

Returns:

  • (Symbol)


27
28
29
# File 'lib/active_interaction/filter/error.rb', line 27

def name
  @name
end

#optionsHash (readonly)

Options passed to the error for error message creation.

Returns:

  • (Hash)


32
33
34
# File 'lib/active_interaction/filter/error.rb', line 32

def options
  @options
end

#typeSymbol (readonly)

The type of error.

Returns:

  • (Symbol)


37
38
39
# File 'lib/active_interaction/filter/error.rb', line 37

def type
  @type
end