class ActiveGraph::Shared::TypeConverters::BooleanConverter

Constants

FALSE_VALUES

Public Class Methods

convert_type()
Alias for: db_type
converted?(value) click to toggle source
    # File lib/active_graph/shared/type_converters.rb
198 def converted?(value)
199   converted_values.include?(value)
200 end
converted_values() click to toggle source
    # File lib/active_graph/shared/type_converters.rb
202 def converted_values
203   [true, false]
204 end
db_type() click to toggle source
    # File lib/active_graph/shared/type_converters.rb
206 def db_type
207   ActiveGraph::Shared::Boolean
208 end
Also aliased as: convert_type
to_db(value) click to toggle source
    # File lib/active_graph/shared/type_converters.rb
212 def to_db(value)
213   return false if FALSE_VALUES.include?(value)
214   case value
215   when TrueClass, FalseClass
216     value
217   when Numeric, /^\-?[0-9]/
218     !value.to_f.zero?
219   else
220     value.present?
221   end
222 end
Also aliased as: to_ruby
to_ruby(value)
Alias for: to_db