Skip to content

Commit e6aae98

Browse files
committed
Move sensitive attribute to global constant
1 parent 6f9819e commit e6aae98

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/openai/client.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module OpenAI
22
class Client
33
include OpenAI::HTTP
44

5+
SENSITIVE_ATTRIBUTES = %i[@access_token @organization_id @extra_headers].freeze
56
CONFIG_KEYS = %i[
67
api_type
78
api_version
@@ -109,12 +110,10 @@ def beta(apis)
109110
end
110111

111112
def inspect
112-
sensitive_attributes = %i[@access_token @organization_id @extra_headers]
113-
114113
vars = instance_variables.map do |var|
115114
value = instance_variable_get(var)
116115

117-
sensitive_attributes.include?(var) ? "#{var}=[REDACTED]" : "#{var}=#{value.inspect}"
116+
SENSITIVE_ATTRIBUTES.include?(var) ? "#{var}=[REDACTED]" : "#{var}=#{value.inspect}"
118117
end
119118

120119
"#<#{self.class}:#{object_id} #{vars.join(', ')}>"

0 commit comments

Comments
 (0)