Class: CSVImportable::TypeParser::BooleanTypeParser
Instance Attribute Summary
#key, #required, #row, #value
Instance Method Summary
collapse
#initialize, #parse
Instance Method Details
#error_message ⇒ Object
9
10
11
|
# File 'lib/csv_importable/type_parser/boolean_type_parser.rb', line 9
def error_message
"Invalid boolean for column: #{key}"
end
|
#parse_val ⇒ Object
3
4
5
6
7
|
# File 'lib/csv_importable/type_parser/boolean_type_parser.rb', line 3
def parse_val
val = true if ["yes", "y", true, "true"].include?(value.downcase)
val = false if ["no", "n", false, "false"].include?(value.downcase)
val
end
|