Class: ActiveInteraction::BooleanFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/active_interaction/filters/boolean_filter.rb

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



21
22
23
24
25
26
27
28
29
30
# File 'lib/active_interaction/filters/boolean_filter.rb', line 21

def cast(value)
  case value
  when FalseClass, '0', /\Afalse\z/i
    false
  when TrueClass, '1', /\Atrue\z/i
    true
  else
    super
  end
end

#database_column_typeObject



32
33
34
# File 'lib/active_interaction/filters/boolean_filter.rb', line 32

def database_column_type
  self.class.slug
end