diff --git a/src/yaml/from_yaml.cr b/src/yaml/from_yaml.cr index b13881594732..98fe2c29c6f0 100644 --- a/src/yaml/from_yaml.cr +++ b/src/yaml/from_yaml.cr @@ -30,7 +30,14 @@ def Nil.new(pull : YAML::PullParser) end def Bool.new(pull : YAML::PullParser) - pull.read_scalar == "true" + case value + when "true", "True", "TRUE", "on", "On", "ON", "y", "Y", "yes", "Yes", "YES" + true + when "false", "False", "FALSE", "off", "Off", "OFF", "n", "N", "no", "No", "NO" + false + else + raise YAML::ParseException.new("Expected bool, not #{value}", 0, 0) + end end {% for type in %w(Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64) %}