Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions lib/stripe/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

module Stripe
module Util
LEGAL_FIRST_CHARACTER = /[a-zA-Z_]/.freeze
LEGAL_VARIABLE_CHARACTER = /[a-zA-Z0-9_]/.freeze

def self.objects_to_ids(obj, serialize_empty: false)
case obj
when APIResource
Expand Down Expand Up @@ -329,9 +326,7 @@ def self.normalize_opts(opts)
# Return false for strings that are invalid variable names
# Does NOT expect there to be a preceding '@' for instance variables
def self.valid_variable_name?(key)
return false if key.empty? || key[0] !~ LEGAL_FIRST_CHARACTER

key[1..].chars.all? { |char| char =~ LEGAL_VARIABLE_CHARACTER }
key.match?(/\A[a-zA-Z_]\w*\z/)
end

def self.check_string_argument!(key)
Expand Down