lib/contentful/resource.rb in contentful-1.2.1 vs lib/contentful/resource.rb in contentful-1.2.2
- old
+ new
@@ -16,10 +16,10 @@
# @see _ examples/resource_mapping.rb Mapping a Custom Class
module Resource
# @private
# rubocop:disable Style/DoubleNegation
COERCIONS = {
- string: ->(v) { v.to_s },
+ string: ->(v) { v.nil? ? nil : v.to_s },
integer: ->(v) { v.to_i },
float: ->(v) { v.to_f },
boolean: ->(v) { !!v },
date: ->(v) { DateTime.parse(v) }
}