moduleArelmoduleAttributesclassBoolean<Attributedeftype_cast(value)casevaluewhentrue,falsethenvalue# when nil then options[:allow_nil] ? nil : falsewhennilthenfalsewhen1thentruewhen0thenfalseelsecasevalue.to_s.downcase.stripwhen'true'thentruewhen'false'thenfalseelseraisetypecast_error(value)endendendendendend