We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the following for true and false values:
FALSE_BASE = [false, 0, 'off', 'f'].freeze TRUE_BASE = [true, 1, 'on', 't'].freeze def boolean_variants(base) base.map { |f| s = f.to_s; [f, s.downcase, s.downcase.to_sym, s.upcase, s.upcase.to_sym] }.flatten.uniq end TRUE_VALUES = boolean_variants(TRUE_BASE).to_set.freeze # #<Set: {true, "true", :true, "TRUE", :TRUE, 1, "1", :"1", "on", :on, "ON", :ON, "t", :t, "T", :T}> FALSE_VALUES = boolean_variants(FALSE_BASE).to_set.freeze # #<Set: {false, "false", :false, "FALSE", :FALSE, 0, "0", :"0", "off", :off, "OFF", :OFF, "f", :f, "F", :F}>
See ActiveRecord::Type::Boolean for the inspiration.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Use the following for true and false values:
See ActiveRecord::Type::Boolean for the inspiration.
The text was updated successfully, but these errors were encountered: