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.

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) ⇒ Object



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

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

#database_column_typeObject



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

def database_column_type
  self.class.slug
end