Method: BarkestCore::BooleanParser.parse_for_boolean_column
- Defined in:
- lib/barkest_core/concerns/boolean_parser.rb
.parse_for_boolean_column(value) ⇒ Object
Parses for a 3-way boolean.
If the value is nil, then nil is returned. If the value is ‘true’, ‘yes’, ‘on’, ‘1’, ‘t’, or ‘y’ then true is returned. Otherwise false is returned.
14 15 16 17 18 |
# File 'lib/barkest_core/concerns/boolean_parser.rb', line 14 def self.parse_for_boolean_column(value) return nil if value.to_s.blank? value = value.to_s.downcase %w(true yes on 1 -1 t y).include? value end |