lib/recurly/schema/schema_validator.rb in recurly-3.2.1 vs lib/recurly/schema/schema_validator.rb in recurly-3.2.2
- old
+ new
@@ -37,15 +37,15 @@
unless val.nil? || schema_attr.is_valid?(val)
# If it's safely castable, the json deserializer or server
# will take care of it for us
unless safely_castable?(val.class, schema_attr.type)
expected = case schema_attr
- when Schema::ArrayAttribute
- "Array of #{schema_attr.type}s"
- else
- schema_attr.type
- end
+ when Schema::ArrayAttribute
+ "Array of #{schema_attr.type}s"
+ else
+ schema_attr.type
+ end
raise ArgumentError, "Attribute '#{name}' on the resource #{self.class.name} is type #{val.class} but should be a #{expected}"
end
end
@@ -71,13 +71,13 @@
private
def safely_castable?(from_type, to_type)
# TODO we can drop this switch when 2.3 support is dropped
int_class = if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.4.0")
- :Integer
- else
- :Fixnum
- end
+ :Integer
+ else
+ :Fixnum
+ end
int_class = Kernel.const_get(int_class)
case [from_type, to_type]
when [Symbol, String]
true