lib/schemacop/v3/string_node.rb in schemacop-3.0.0 vs lib/schemacop/v3/string_node.rb in schemacop-3.0.1
- old
+ new
@@ -14,10 +14,11 @@
'date-time': /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$/,
time: /^(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$/,
email: URI::MailTo::EMAIL_REGEXP,
boolean: /^(true|false)$/,
binary: nil,
+ symbol: nil,
integer: /^-?[0-9]+$/,
number: /^-?[0-9]+(\.[0-9]+)?$/
}.freeze
# rubocop:enable Layout/LineLength
@@ -85,9 +86,11 @@
Time.parse(to_cast)
when :integer
return Integer(to_cast)
when :number
return Float(to_cast)
+ when :symbol
+ return to_cast.to_sym
else
return to_cast
end
end