From 776d45f116692dbefa2e0a3e9517e1abb102c914 Mon Sep 17 00:00:00 2001 From: Brandur Date: Thu, 5 Apr 2018 15:42:46 -0700 Subject: [PATCH] Initialize instance variable on the getter too The test suite is currently throwing a bunch of warnings from some recent changes I made -- although we initialize `@additive_params` when setting one with `self.additive_object_param`, we don't when we check one with `self.additive_object_param?`. This often isn't a problem because every API resource sets `metadata`, but it is from the test suite and probably for vanilla `StripeObject`s too. --- lib/stripe/stripe_object.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/stripe/stripe_object.rb b/lib/stripe/stripe_object.rb index 9ba927db5..3aca0757e 100644 --- a/lib/stripe/stripe_object.rb +++ b/lib/stripe/stripe_object.rb @@ -64,7 +64,8 @@ def self.additive_object_param(name) # Returns whether the given name is an additive object parameter. See # `.additive_object_param` for details. def self.additive_object_param?(name) - !@additive_params.nil? && @additive_params.include?(name) + @additive_params ||= Set.new + @additive_params.include?(name) end def initialize(id = nil, opts = {})