class Formulario::Field::Boolean
Private Class Methods
build(raw_value)
click to toggle source
# File lib/formulario/fields/boolean.rb, line 6 def self.build(raw_value) case get_value(raw_value) when true, 'true', 't', '1' new true when false, 'false', 'f', '0', '' new false else ExceptionalValue.new(raw_value, reasons: ['needs to be boolean']) end end
default()
click to toggle source
# File lib/formulario/fields/boolean.rb, line 21 def self.default new(false) end
get_value(raw_value)
click to toggle source
# File lib/formulario/fields/boolean.rb, line 17 def self.get_value(raw_value) raw_value.to_s.downcase end