Class: ActiveInteraction::AbstractNumericFilter Abstract

Inherits:
AbstractFilter show all
Defined in:
lib/active_interaction/filters/abstract_numeric_filter.rb

Overview

This class is abstract.

Common logic for filters that handle numeric objects.

Since:

  • 1.0.0

Direct Known Subclasses

DecimalFilter, FloatFilter, IntegerFilter

Instance Attribute Summary

Attributes inherited from Filter

#filters, #name, #options

Instance Method Summary collapse

Methods inherited from Filter

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

Constructor Details

This class inherits a constructor from ActiveInteraction::Filter

Instance Method Details

#cast(value, context) ⇒ Object

Since:

  • 1.0.0



14
15
16
17
18
19
20
21
22
23
# File 'lib/active_interaction/filters/abstract_numeric_filter.rb', line 14

def cast(value, context)
  case value
  when klass
    value
  when Numeric, String
    convert(value, context)
  else
    super
  end
end

#database_column_typeObject

Since:

  • 1.0.0



25
26
27
# File 'lib/active_interaction/filters/abstract_numeric_filter.rb', line 25

def database_column_type
  self.class.slug
end