Skip to content

Commit

Permalink
Initialize instance variable on the getter too
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brandur committed Apr 5, 2018
1 parent 2f322ca commit 776d45f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/stripe/stripe_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {})
Expand Down

0 comments on commit 776d45f

Please sign in to comment.