Skip to content

Commit

Permalink
Merge pull request #21 from jgaskins/optimize-unique
Browse files Browse the repository at this point in the history
Optimize `unique_*` methods
  • Loading branch information
askn authored Apr 21, 2024
2 parents c8875e3 + 4b7ace6 commit 9223359
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/faker/base.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Faker
alias Any = String | Int32 | Float64 | Time

macro uniquify_builder(attribute_name, *modified_method_attributes)
@@__unique_vals_for_{{attribute_name}} = Array(Any).new
@@__unique_vals_for_{{attribute_name}} = Set(Any).new

def self.unique_{{attribute_name}}({% if !modified_method_attributes.empty? %}{{*modified_method_attributes}},{% end %} max_retries = 10_0000)
max_retries.times do |t|
Expand Down

0 comments on commit 9223359

Please sign in to comment.