faker 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93fd1390fde066edf506ec3222f2e26a42a038fe9a7065c13bb2b085d1ec34ab
4
- data.tar.gz: f34ed750ff9f8bf3e89db66a94e99ecd83518bc0f96e39faf0254e43a2dab328
3
+ metadata.gz: f0f1f57798bdd12f9abe18fb1addd4d6ed4126bd9dd6511f85f65db979a8f09f
4
+ data.tar.gz: 11c90330d5e8d3aa1135acd2ec8b830ccdc84bfecfdab608a5104e73cc5cf46f
5
5
  SHA512:
6
- metadata.gz: b5dda78d9ef08db5a8cfd572d9d2cb7983db27c17122468239dd4dea53cba2581bec484f604c4a2a67eee4ca23ba3406c327dbfc2377fd3a1cb6c6126ce56228
7
- data.tar.gz: dbfaa6124b325fa82b240e77b8bf3e49e1f29b55d6f8ccbd12aab57746a7c6f01948b58825f041397540808f7c400ebc3d92dc17528ed928ca1c19becec4ef7f
6
+ metadata.gz: cc7aefa18cbf98cb6cf85de656e2b61bbc4c9ef42ba40f381113b3c7ec22be420ea04fa8cc8d7ae1ed30871bc95ce8a14117ae6d600a97b78c16857b2bf05fd2
7
+ data.tar.gz: 3f82d2eda0d9758364947ae6642f1d92b0db82589884a83a42f3ac08ae30cd59b85c0b60dc1b712595e2950cc97e8c1adb266445cdaea54725b195bd3ec17d1a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.6.1](https://github.com/faker-ruby/faker/tree/v3.6.1) (2026-03-04)
4
+
5
+ It's almost Spring time in the Northern hemisphere 🌸
6
+
7
+ ### Security, performance improvements and bug fixes
8
+
9
+ * fix: polynomial regex on uncontrolled input by @thdaraujo in https://github.com/faker-ruby/faker/pull/3196
10
+ * perf: replaces list of postcodes in `ja/address.yml` with a 7-digit format by @thdaraujo in https://github.com/faker-ruby/faker/pull/3201
11
+ * Remove unnecessary whitespace from code blocks in READMEs by @ryotaro-shirai in https://github.com/faker-ruby/faker/pull/3209
12
+ * Document lazy load experiment results by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3205
13
+ * [skip ci] Add-backtick by @OzuAkira in https://github.com/faker-ruby/faker/pull/3210
14
+ * Zeitwerk experiment changes and results [skip ci] by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3213
15
+ * Remove duplicate reference link in README.md by @yutasb in https://github.com/faker-ruby/faker/pull/3217
16
+
17
+ ### Update development dependencies
18
+
19
+ * Bump rubocop from 1.84.0 to 1.84.1 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3202
20
+ * Bump irb from 1.16.0 to 1.17.0 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3203
21
+ * Bump rubocop version and fix offenses by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3198
22
+ * Bump rdoc from 7.1.0 to 7.2.0 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3204
23
+ * Bump rubocop to 1.84.2 by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3215
24
+ * Bump rubocop-minitest from 0.38.2 to 0.39.1 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3216
25
+ * Bump rubocop to v1.85.0 by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3220
26
+
27
+ ### New Contributors
28
+ * @ryotaro-shirai made their first contribution in https://github.com/faker-ruby/faker/pull/3209
29
+ * @OzuAkira made their first contribution in https://github.com/faker-ruby/faker/pull/3210
30
+ * @yutasb made their first contribution in https://github.com/faker-ruby/faker/pull/3217
31
+
32
+ **Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.6.0...v3.6.1
33
+
34
+ ---------------------------------
35
+
3
36
  ## [v3.6.0](https://github.com/faker-ruby/faker/tree/v3.6.0) (2026-01-21)
4
37
 
5
38
  First release of the new year!
data/README.md CHANGED
@@ -11,7 +11,6 @@
11
11
  [github-actions]: https://github.com/faker-ruby/faker/actions
12
12
  [downloads-total]: https://img.shields.io/gem/dt/faker.svg
13
13
  [downloads-badge]: https://img.shields.io/gem/dtv/faker.svg
14
- [downloads-badge]: https://img.shields.io/gem/dtv/faker.svg
15
14
 
16
15
  ## Quick links
17
16
 
@@ -157,7 +156,7 @@ To prevent Faker (version >= 2.22) from [generating duplicate values](https://gi
157
156
  you might need to add the following to the `test_helper.rb` or `rails_helper.rb` file:
158
157
 
159
158
  ```ruby
160
- Faker::Config.random = Random.new
159
+ Faker::Config.random = Random.new
161
160
  ```
162
161
 
163
162
  ## Generators
@@ -137,7 +137,7 @@ module Faker
137
137
  Faker::Number.number(digits: 2),
138
138
  Faker::Number.between(from: 13, to: 99),
139
139
  Faker::Number.between(from: 32, to: 99)
140
- ].map(&:to_s).join
140
+ ].join
141
141
 
142
142
  id_number = [
143
143
  invalid_date_of_birth,
@@ -24,7 +24,7 @@ module Faker
24
24
  private
25
25
 
26
26
  def select_a(length)
27
- if length.class.included_modules.include? Enumerable
27
+ if length.class.include?(Enumerable)
28
28
  select_a sample(length.to_enum.to_a)
29
29
  else
30
30
  length # recursive base case
data/lib/faker/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Faker # :nodoc:
4
- VERSION = '3.6.0'
4
+ VERSION = '3.6.1'
5
5
  end
data/lib/faker.rb CHANGED
@@ -95,12 +95,12 @@ module Faker
95
95
  reg
96
96
  .gsub(%r{^/?\^?}, '').gsub(%r{\$?/?$}, '') # Ditch the anchors
97
97
  .gsub(/\{(\d+)\}/, '{\1,\1}').gsub('?', '{0,1}') # All {2} become {2,2} and ? become {0,1}
98
- .gsub(/(\[[^\]]+\])\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # [12]{1,2} becomes [12] or [12][12]
99
- .gsub(/(\([^)]+\))\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # (12|34){1,2} becomes (12|34) or (12|34)(12|34)
100
- .gsub(/(\\?.)\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # A{1,2} becomes A or AA or \d{3} becomes \d\d\d
101
- .gsub(/\((.*?)\)/) { |match| sample(match.gsub(/[()]/, '').split('|')) } # (this|that) becomes 'this' or 'that'
102
- .gsub(/\[([^\]]+)\]/) { |match| match.gsub(/(\w-\w)/) { |range| sample(Array(Range.new(*range.split('-')))) } } # All A-Z inside of [] become C (or X, or whatever)
103
- .gsub(/\[([^\]]+)\]/) { |_match| sample(Regexp.last_match(1).chars) } # All [ABC] become B (or A or C)
98
+ .gsub(/(\[[^\]]++\])\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # [12]{1,2} becomes [12] or [12][12]
99
+ .gsub(/(\([^)]++\))\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # (12|34){1,2} becomes (12|34) or (12|34)(12|34)
100
+ .gsub(/(\\?.)\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # A{1,2} becomes A or AA or \d{3} becomes \d\d\d
101
+ .gsub(/\((.*?)\)/) { |match| sample(match.gsub(/[()]/, '').split('|')) } # (this|that) becomes 'this' or 'that'
102
+ .gsub(/\[([^\]]++)\]/) { |match| match.gsub(/(\w-\w)/) { |range| sample(Array(Range.new(*range.split('-')))) } } # All A-Z inside of [] become C (or X, or whatever)
103
+ .gsub(/\[([^\]]++)\]/) { |_match| sample(Regexp.last_match(1).chars) } # All [ABC] become B (or A or C)
104
104
  .gsub('\d') { |_match| sample(Numbers) }
105
105
  .gsub('\w') { |_match| sample(Letters) }
106
106
  end
@@ -133,7 +133,8 @@ module Faker
133
133
  # formatted translation: e.g., "#{first_name} #{last_name}".
134
134
  def parse(key)
135
135
  fetched = fetch(key)
136
- parts = fetched.scan(/(\(?)#\{([A-Za-z]+\.)?([^}]+)\}([^#]+)?/).map do |prefix, kls, meth, etc|
136
+
137
+ parts = fetched.scan(/(\(?)#\{([A-Za-z]+\.)?([^}]+)\}([^#]++)?/).map do |prefix, kls, meth, etc|
137
138
  # If the token had a class Prefix (e.g., Name.first_name)
138
139
  # grab the constant, otherwise use self
139
140
  cls = kls ? Faker.const_get(kls.chop) : self
@@ -30,7 +30,7 @@ module Faker
30
30
  method_name.to_s.start_with?('faker_') || super
31
31
  end
32
32
 
33
- RetryLimitExceeded = Class.new(StandardError)
33
+ class RetryLimitExceeded < StandardError; end
34
34
 
35
35
  def previous_results
36
36
  Thread.current[:faker_unique_generator_previous_results] ||= {}
@@ -20,7 +20,7 @@ Faker::Hipster.word #=> "kogi"
20
20
 
21
21
  ## How to update a locale with more translations
22
22
 
23
- To update a locale with more translation features, simply add a new field to the .yml file that corresponds to an existing piece of functionality in the "en.yml" file. In this example, that would mean providing Chinese hipster words.
23
+ To update a locale with more translation features, simply add a new field to the `.yml` file that corresponds to an existing piece of functionality in the "en.yml" file. In this example, that would mean providing Chinese hipster words.
24
24
 
25
25
  ```yaml
26
26
  # /lib/locales/zh-CN.yml
@@ -52,5 +52,5 @@ Faker::Config.default_locale = :pt
52
52
  In threaded server environments, e.g., Puma, locale per thread can be set as the following:
53
53
 
54
54
  ```ruby
55
- Faker::Config.locale = :es
55
+ Faker::Config.locale = :es
56
56
  ```