faker 2.18.0 → 2.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +44 -0
- data/README.md +3 -0
- data/lib/faker/default/commerce.rb +28 -0
- data/lib/faker/default/company.rb +1 -1
- data/lib/faker/default/emotion.rb +33 -0
- data/lib/faker/default/finance.rb +13 -0
- data/lib/faker/default/food.rb +13 -0
- data/lib/faker/default/hobby.rb +22 -0
- data/lib/faker/default/internet.rb +12 -23
- data/lib/faker/default/placeholdit.rb +9 -9
- data/lib/faker/default/science.rb +82 -0
- data/lib/faker/games/dota.rb +13 -0
- data/lib/faker/locations/australia.rb +47 -0
- data/lib/faker/music/hiphop.rb +3 -3
- data/lib/faker/tv_shows/supernatural.rb +48 -0
- data/lib/faker/tv_shows/the_office.rb +37 -0
- data/lib/faker/version.rb +2 -2
- data/lib/locales/de.yml +7 -3
- data/lib/locales/en/animal.yml +1 -1
- data/lib/locales/en/australia.yml +108 -0
- data/lib/locales/en/commerce.yml +17 -0
- data/lib/locales/en/community.yml +17 -17
- data/lib/locales/en/dota.yml +7 -0
- data/lib/locales/en/emotion.yml +480 -0
- data/lib/locales/en/finance.yml +21 -0
- data/lib/locales/en/food.yml +1054 -10
- data/lib/locales/en/hobby.yml +171 -0
- data/lib/locales/en/horse.yml +2 -2
- data/lib/locales/en/kpop.yml +7 -7
- data/lib/locales/en/music.yml +142 -142
- data/lib/locales/en/science.yml +126 -0
- data/lib/locales/en/super_smash_bros.yml +3 -2
- data/lib/locales/en/supernatural.yml +141 -0
- data/lib/locales/en/the_office.yml +86 -0
- data/lib/locales/en/touhou.yml +1 -1
- data/lib/locales/es-AR.yml +1 -4
- data/lib/locales/fr/animal.yml +5 -0
- data/lib/locales/fr/appliance.yml +4 -0
- data/lib/locales/fr/pokemon.yml +0 -2
- data/lib/locales/ja/address.yml +124434 -1
- data/lib/locales/ja/animal.yml +5 -0
- data/lib/locales/ja/cat.yml +5 -0
- data/lib/locales/ja/color.yml +1 -1
- data/lib/locales/ja/{creature.yml → dog.yml} +0 -4
- data/lib/locales/ja/overwatch.yml +5 -0
- data/lib/locales/ja/{games.yml → pokemon.yml} +0 -11
- data/lib/locales/ja/studio_ghibli.yml +112 -0
- data/lib/locales/ja/super_mario.yml +9 -0
- data/lib/locales/ja/zelda.yml +5 -0
- data/lib/locales/pt-BR.yml +3 -2
- metadata +29 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67dd53f62e56c7e1a3cd672bb2d81dbee5bdee8a31336ea5c76bcc53390a60f5
|
4
|
+
data.tar.gz: ceb4cbe305f9c16003719ebace13c1a6e4338ca8b9521dab82a22fa7ae1eb270
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cbd4a1b3d6dba3cfdc0ee005522c64f963c9954d3371a0362a03df7d3deec5b67e63ba2828aa11fe371f5aec228bc3d3f4fbc4f2c59505d68020f3d15086a00
|
7
|
+
data.tar.gz: b6e4e5a92e4f3719eabbd370e0278c30bd178960d4574bc84959bdab77551d5d3193373b3c584c46b8a6e0adf201f1c68c73cab5708331db7070955eca4ad68d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,49 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v2.19.0](https://github.com/faker-ruby/faker/tree/v2.19.0) (2021-08-22)
|
4
|
+
|
5
|
+
## Bug/Fixes
|
6
|
+
|
7
|
+
- [PR #2356](https://github.com/faker-ruby/faker/pull/2356) fix broken link for placeholdit [@lilisako](https://github.com/lilisako)
|
8
|
+
- [PR #2351](https://github.com/faker-ruby/faker/pull/2351) Fix spanish organisation number [@laulujan](https://github.com/laulujan)
|
9
|
+
|
10
|
+
## Feature Request
|
11
|
+
|
12
|
+
- [PR #2371](https://github.com/faker-ruby/faker/pull/2371) Add supernatural TV show [@vin1cius](https://github.com/vin1cius)
|
13
|
+
- [PR #2369](https://github.com/faker-ruby/faker/pull/2369) Added more Science examples - science branches, modifiers and tools [@itay-grudev](https://github.com/itay-grudev)
|
14
|
+
- [PR #2361](https://github.com/faker-ruby/faker/pull/2361) Add ethnic category to the food generator [@wolwire](https://github.com/wolwire)
|
15
|
+
- [PR #2359](https://github.com/faker-ruby/faker/pull/2359) add stock_market to finance Faker::Finance [@lilisako](https://github.com/lilisako)
|
16
|
+
- [PR #2341](https://github.com/faker-ruby/faker/pull/2341) add Hobby to default [@rohanphillips](https://github.com/rohanphillips)
|
17
|
+
- [PR #2324](https://github.com/faker-ruby/faker/pull/2324) Add Faker::Emotion.word [@jayqui](https://github.com/jayqui)
|
18
|
+
- [PR #2320](https://github.com/faker-ruby/faker/pull/2320) Add Faker::TvShows::TheOffice [@sandylcruz](https://github.com/sandylcruz)
|
19
|
+
- [PR #2245](https://github.com/faker-ruby/faker/pull/2245) Add Faker::Australia class [@astley92](https://github.com/astley92)
|
20
|
+
- [PR #1731](https://github.com/faker-ruby/faker/pull/1731) add brand, vendor support to commerce [@ashishra0](https://github.com/ashishra0)
|
21
|
+
|
22
|
+
## Update locales
|
23
|
+
|
24
|
+
- [PR #2343](https://github.com/faker-ruby/faker/pull/2343) Minor typo fixes to Community quotes [@sunny](https://github.com/sunny)
|
25
|
+
- [PR #2340](https://github.com/faker-ruby/faker/pull/2340) Add JapaneseMedia StudioGhibli for locals/ja.yml [@ryogift](https://github.com/ryogift)
|
26
|
+
- [PR #2339](https://github.com/faker-ruby/faker/pull/2339) Various locale specific and other fixes for faker [@psibi](https://github.com/psibi)
|
27
|
+
- [PR #2338](https://github.com/faker-ruby/faker/pull/2338) Add Kazuya to Faker::Games::SuperSmashBros [@boardfish](https://github.com/boardfish)
|
28
|
+
- [PR #2333](https://github.com/faker-ruby/faker/pull/2333) add FR translation for animals [@cprodhomme](https://github.com/cprodhomme)
|
29
|
+
- [PR #2329](https://github.com/faker-ruby/faker/pull/2329) Fix Faker::Color.color_name for Japanese [@yujideveloper](https://github.com/yujideveloper)
|
30
|
+
- [PR #2327](https://github.com/faker-ruby/faker/pull/2327) Remove trailing spaces from translations [@michebble](https://github.com/michebble)
|
31
|
+
- [PR #2326](https://github.com/faker-ruby/faker/pull/2326) Faker::Address.postcode (locale=ja) should contains hyphen [@gongo](https://github.com/gongo)
|
32
|
+
|
33
|
+
## Update local dependencies
|
34
|
+
|
35
|
+
- Update rubocop requirement from = 1.18.3 to = 1.18.4 (#2362)
|
36
|
+
- Update rake requirement from = 13.0.3 to = 13.0.6 (#2357)
|
37
|
+
- Update rubocop requirement from = 1.18.1 to = 1.18.3 (#2353)
|
38
|
+
- Update rubocop requirement from = 1.17.0 to = 1.18.1 (#2346)
|
39
|
+
- Update rubocop requirement from = 1.16.0 to = 1.17.0 (#2337)
|
40
|
+
- Update test-unit requirement from = 3.4.2 to = 3.4.4 (#2334)
|
41
|
+
- Update rubocop requirement from = 1.15.0 to = 1.16.0 (#2332)
|
42
|
+
- Update test-unit requirement from = 3.4.1 to = 3.4.2 (#2331)
|
43
|
+
- Update rubocop requirement from = 1.14.0 to = 1.15.0 (#2325)
|
44
|
+
|
45
|
+
------------------------------------------------------------------------------
|
46
|
+
|
3
47
|
## [v2.18.0](https://github.com/faker-ruby/faker/tree/v2.18.0) (2021-05-15)
|
4
48
|
|
5
49
|
## Bug/Fixes
|
data/README.md
CHANGED
@@ -161,6 +161,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
161
161
|
- [Faker::Drone](doc/drone/drone.md)
|
162
162
|
- [Faker::Educator](doc/default/educator.md)
|
163
163
|
- [Faker::ElectricalComponents](doc/default/electrical_components.md)
|
164
|
+
- [Faker::Emotion](doc/default/emotion.md)
|
164
165
|
- [Faker::Esport](doc/default/esport.md)
|
165
166
|
- [Faker::File](doc/default/file.md)
|
166
167
|
- [Faker::Fillmurray](doc/default/fillmurray.md)
|
@@ -171,6 +172,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
171
172
|
- [Faker::GreekPhilosophers](doc/default/greek_philosophers.md)
|
172
173
|
- [Faker::Hacker](doc/default/hacker.md)
|
173
174
|
- [Faker::Hipster](doc/default/hipster.md)
|
175
|
+
- [Faker::Hobby](doc/default/hobby.md)
|
174
176
|
- [Faker::House](doc/default/house.md)
|
175
177
|
- [Faker::IDNumber](doc/default/id_number.md)
|
176
178
|
- [Faker::IndustrySegments](doc/default/industry_segments.md)
|
@@ -339,6 +341,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
339
341
|
- [Faker::TvShows::Stargate](doc/tv_shows/stargate.md)
|
340
342
|
- [Faker::TvShows::StrangerThings](doc/tv_shows/stranger_things.md)
|
341
343
|
- [Faker::TvShows::Suits](doc/tv_shows/suits.md)
|
344
|
+
- [Faker::TvShows::Supernatural](doc/tv_shows/supernatural.md)
|
342
345
|
- [Faker::TvShows::TheExpanse](doc/tv_shows/the_expanse.md)
|
343
346
|
- [Faker::TvShows::TheFreshPrinceOfBelAir](doc/tv_shows/the_fresh_prince_of_bel_air.md)
|
344
347
|
- [Faker::TvShows::TheITCrowd](doc/tv_shows/the_it_crowd.md)
|
@@ -126,6 +126,34 @@ module Faker
|
|
126
126
|
price
|
127
127
|
end
|
128
128
|
|
129
|
+
##
|
130
|
+
# Produces a randomized string of a brand name
|
131
|
+
# @example
|
132
|
+
# Faker::Commerce.brand #=> 'Apple'
|
133
|
+
#
|
134
|
+
# @return [string]
|
135
|
+
#
|
136
|
+
# @faker.version next
|
137
|
+
#
|
138
|
+
##
|
139
|
+
def brand
|
140
|
+
fetch('commerce.brand')
|
141
|
+
end
|
142
|
+
|
143
|
+
##
|
144
|
+
# Produces a randomized string of a vendor name
|
145
|
+
# @example
|
146
|
+
# Faker::Commerce.vendor #=> 'Dollar General'
|
147
|
+
#
|
148
|
+
# @return [string]
|
149
|
+
#
|
150
|
+
# @faker.version next
|
151
|
+
#
|
152
|
+
##
|
153
|
+
def vendor
|
154
|
+
fetch('commerce.vendor')
|
155
|
+
end
|
156
|
+
|
129
157
|
private
|
130
158
|
|
131
159
|
def categories(num)
|
@@ -553,7 +553,7 @@ module Faker
|
|
553
553
|
end
|
554
554
|
|
555
555
|
def spanish_cif_control_digit(organization_type, code)
|
556
|
-
letters = %w[J A B C D E F G H]
|
556
|
+
letters = %w[J A B C D E F G H I]
|
557
557
|
|
558
558
|
control = code.split('').each_with_index.inject(0) do |sum, (value, index)|
|
559
559
|
if (index + 1).even?
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Faker
|
4
|
+
class Emotion < Base
|
5
|
+
class << self
|
6
|
+
##
|
7
|
+
# Produces an emotion noun.
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Faker::Emotion.noun #=> "amazement"
|
13
|
+
#
|
14
|
+
# @faker.version next
|
15
|
+
def noun
|
16
|
+
fetch('emotion.noun')
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Produces an emotion adjective.
|
21
|
+
#
|
22
|
+
# @return [String]
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Faker::Emotion.adjective # => "nonplussed"
|
26
|
+
#
|
27
|
+
# @faker.version next
|
28
|
+
def adjective
|
29
|
+
fetch('emotion.adjective')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -84,6 +84,19 @@ module Faker
|
|
84
84
|
rescue I18n::MissingTranslationData
|
85
85
|
raise ArgumentError, "Could not find market named #{market}"
|
86
86
|
end
|
87
|
+
|
88
|
+
##
|
89
|
+
# Returns a randomly-selected stock market.
|
90
|
+
#
|
91
|
+
# @return [String]
|
92
|
+
#
|
93
|
+
# @example
|
94
|
+
# Faker::Finance.stock_market #=> 'NASDAQ'
|
95
|
+
#
|
96
|
+
# @faker.version next
|
97
|
+
def stock_market
|
98
|
+
fetch('finance.stock_market')
|
99
|
+
end
|
87
100
|
end
|
88
101
|
end
|
89
102
|
end
|
data/lib/faker/default/food.rb
CHANGED
@@ -108,6 +108,19 @@ module Faker
|
|
108
108
|
def metric_measurement
|
109
109
|
fetch('food.metric_measurements')
|
110
110
|
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Retrieves ethnic category
|
114
|
+
#
|
115
|
+
# @return [String]
|
116
|
+
#
|
117
|
+
# @example
|
118
|
+
# Faker::Food.ethnic_category #=> "Indian cuisine"
|
119
|
+
#
|
120
|
+
# @faker.version next
|
121
|
+
def ethnic_category
|
122
|
+
fetch('food.ethnic_category')
|
123
|
+
end
|
111
124
|
end
|
112
125
|
end
|
113
126
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Faker
|
4
|
+
class Hobby < Base
|
5
|
+
flexible :hobby
|
6
|
+
|
7
|
+
class << self
|
8
|
+
##
|
9
|
+
# Retrieves a typical hobby activity.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::Hobby.activity #=> "Cooking"
|
15
|
+
#
|
16
|
+
# @faker.version next
|
17
|
+
def activity
|
18
|
+
fetch('hobby.activity')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -531,32 +531,21 @@ module Faker
|
|
531
531
|
end
|
532
532
|
|
533
533
|
##
|
534
|
-
# Produces a
|
535
|
-
#
|
536
|
-
# @param length [Integer] The length of the string to generate
|
537
|
-
# @param padding [Boolean] Toggles if a final equal '=' will be added.
|
538
|
-
# @param urlsafe [Boolean] Toggles charset to '-' and '_' instead of '+' and '/'.
|
539
|
-
#
|
540
|
-
# @return [String]
|
541
|
-
#
|
534
|
+
# Produces a randomized hash of internet user details
|
542
535
|
# @example
|
543
|
-
# Faker::Internet.
|
544
|
-
#
|
536
|
+
# Faker::Internet.user #=> { username: 'alexie', email: 'alexie@example.net' }
|
537
|
+
#
|
545
538
|
# @example
|
546
|
-
# Faker::Internet.
|
547
|
-
# #=> "x1/R="
|
539
|
+
# Faker::Internet.user('username', 'email', 'password') #=> { username: 'alexie', email: 'alexie@example.net', password: 'DtEf9P8wS31iMyC' }
|
548
540
|
#
|
549
|
-
# @
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
s = Array.new(length) { sample(char_range) }.join
|
558
|
-
s += '=' if padding
|
559
|
-
s
|
541
|
+
# @return [hash]
|
542
|
+
#
|
543
|
+
# @faker.version next
|
544
|
+
def user(*args)
|
545
|
+
user_hash = {}
|
546
|
+
args = %w[username email] if args.empty?
|
547
|
+
args.each { |arg| user_hash[:"#{arg}"] = send(arg) }
|
548
|
+
user_hash
|
560
549
|
end
|
561
550
|
|
562
551
|
alias user_name username
|
@@ -8,7 +8,7 @@ module Faker
|
|
8
8
|
# rubocop:disable Metrics/ParameterLists
|
9
9
|
|
10
10
|
##
|
11
|
-
# Produces a random placeholder image from https://
|
11
|
+
# Produces a random placeholder image from https://via.placeholder.com.
|
12
12
|
#
|
13
13
|
# @param size [String] Specifies the image's size, dimensions separated by 'x'.
|
14
14
|
# @param format [String] Specifies the image's extension.
|
@@ -19,13 +19,13 @@ module Faker
|
|
19
19
|
#
|
20
20
|
# @example
|
21
21
|
# # Keyword arguments: size, format, background_color, text_color, text
|
22
|
-
# Faker::Placeholdit.image #=> "https://
|
23
|
-
# Faker::Placeholdit.image(size: '50x50') #=> "https://
|
24
|
-
# Faker::Placeholdit.image(size: '50x50', format: 'jpg') #=> "https://
|
25
|
-
# Faker::Placeholdit.image(size: '50x50', format: 'gif', background_color: 'ffffff') #=> "https://
|
26
|
-
# Faker::Placeholdit.image(size: '50x50', format: 'jpeg', background_color: :random) #=> "https://
|
27
|
-
# Faker::Placeholdit.image(size: '50x50', format: 'jpeg', background_color: 'ffffff', text_color: '000') #=> "https://
|
28
|
-
# Faker::Placeholdit.image(size: '50x50', format: 'jpg', background_color: 'ffffff', text_color: '000', text: 'Some Custom Text') #=> "https://
|
22
|
+
# Faker::Placeholdit.image #=> "https://via.placeholder.com/300x300.png"
|
23
|
+
# Faker::Placeholdit.image(size: '50x50') #=> "https://via.placeholder.com/50x50.png"
|
24
|
+
# Faker::Placeholdit.image(size: '50x50', format: 'jpg') #=> "https://via.placeholder.com/50x50.jpg"
|
25
|
+
# Faker::Placeholdit.image(size: '50x50', format: 'gif', background_color: 'ffffff') #=> "https://via.placeholder.com/50x50.gif/ffffff"
|
26
|
+
# Faker::Placeholdit.image(size: '50x50', format: 'jpeg', background_color: :random) #=> "https://via.placeholder.com/50x50.jpeg/39eba7"
|
27
|
+
# Faker::Placeholdit.image(size: '50x50', format: 'jpeg', background_color: 'ffffff', text_color: '000') #=> "https://via.placeholder.com/50x50.jpeg/ffffff/000"
|
28
|
+
# Faker::Placeholdit.image(size: '50x50', format: 'jpg', background_color: 'ffffff', text_color: '000', text: 'Some Custom Text') #=> "https://via.placeholder.com/50x50.jpg/ffffff/000?text=Some Custom Text"
|
29
29
|
#
|
30
30
|
# @faker.version 1.6.0
|
31
31
|
def image(legacy_size = NOT_GIVEN, legacy_format = NOT_GIVEN, legacy_background_color = NOT_GIVEN, legacy_text_color = NOT_GIVEN, legacy_text = NOT_GIVEN, size: '300x300', format: 'png', background_color: nil, text_color: nil, text: nil)
|
@@ -45,7 +45,7 @@ module Faker
|
|
45
45
|
raise ArgumentError, "background_color must be a hex value without '#'" unless background_color.nil? || background_color =~ /((?:^\h{3}$)|(?:^\h{6}$)){1}(?!.*\H)/
|
46
46
|
raise ArgumentError, "text_color must be a hex value without '#'" unless text_color.nil? || text_color =~ /((?:^\h{3}$)|(?:^\h{6}$)){1}(?!.*\H)/
|
47
47
|
|
48
|
-
image_url = "https://
|
48
|
+
image_url = "https://via.placeholder.com/#{size}.#{format}"
|
49
49
|
image_url += "/#{background_color}" if background_color
|
50
50
|
image_url += "/#{text_color}" if text_color
|
51
51
|
image_url += "?text=#{text}" if text
|
@@ -3,6 +3,47 @@
|
|
3
3
|
module Faker
|
4
4
|
class Science < Base
|
5
5
|
class << self
|
6
|
+
BRANCHES = {
|
7
|
+
empirical: %i[empirical_natural_basic empirical_natural_applied empirical_social_basic empirical_social_applied],
|
8
|
+
formal: %i[formal_basic formal_applied],
|
9
|
+
natural: %i[empirical_natural_basic empirical_natural_applied],
|
10
|
+
social: %i[empirical_social_basic empirical_social_applied],
|
11
|
+
basic: %i[empirical_natural_basic empirical_social_basic formal_basic],
|
12
|
+
applied: %i[empirical_natural_applied empirical_social_applied formal_applied]
|
13
|
+
}.freeze
|
14
|
+
|
15
|
+
##
|
16
|
+
# Produces a name of a science
|
17
|
+
# You can optionally filter by specifying one or more of the following:
|
18
|
+
# `:empirical, :formal, :natural, :social, :basic, :applied`
|
19
|
+
# @see https://en.wikipedia.org/wiki/Science#Branches_of_science
|
20
|
+
# @see Faker::Educator.subject
|
21
|
+
#
|
22
|
+
# @param branches [Array<Symbol>]
|
23
|
+
# @return [String]
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# Faker::Science.science #=> "Space science"
|
27
|
+
# Faker::Science.science(:natural, :applied) #=> "Engineering"
|
28
|
+
# Faker::Science.science(:formal, :applied) #=> "Computer Science"
|
29
|
+
#
|
30
|
+
# @faker.version next
|
31
|
+
def science(*branches)
|
32
|
+
selected = BRANCHES.values.flatten.uniq
|
33
|
+
branches.each do |branch|
|
34
|
+
selected &= BRANCHES[branch] if BRANCHES.key? branch
|
35
|
+
end
|
36
|
+
|
37
|
+
raise ArgumentError, 'Filters do not match any sciences' if selected.empty?
|
38
|
+
|
39
|
+
sciences = []
|
40
|
+
selected.each do |branch|
|
41
|
+
sciences += translate("faker.science.branch.#{branch}")
|
42
|
+
end
|
43
|
+
|
44
|
+
sample(sciences)
|
45
|
+
end
|
46
|
+
|
6
47
|
##
|
7
48
|
# Produces the name of a element.
|
8
49
|
#
|
@@ -67,6 +108,47 @@ module Faker
|
|
67
108
|
def scientist
|
68
109
|
fetch('science.scientist')
|
69
110
|
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Produces a scientifically sounding word
|
114
|
+
#
|
115
|
+
# @return [String]
|
116
|
+
#
|
117
|
+
# @example
|
118
|
+
# Faker::Science.modifier #=> "Quantum"
|
119
|
+
# Faker::Science.modifier #=> "Superconductive"
|
120
|
+
#
|
121
|
+
# @faker.version next
|
122
|
+
def modifier
|
123
|
+
fetch('science.modifier')
|
124
|
+
end
|
125
|
+
|
126
|
+
##
|
127
|
+
# Produces the name of a scientific tool.
|
128
|
+
# By default it uses a science word modifier to generate more diverse data, which can be disabled.
|
129
|
+
#
|
130
|
+
# @param simple [Boolean] Whether to generate simple realistic tool names, (no Q-word).
|
131
|
+
# @return [String]
|
132
|
+
#
|
133
|
+
# @example
|
134
|
+
# Faker::Science.tool #=> "Superconductive Microcentrifuge"
|
135
|
+
# Faker::Science.tool #=> "Portable Cryostat"
|
136
|
+
# Faker::Science.tool #=> "Quantum Spectrophotometer"
|
137
|
+
# Faker::Science.tool(simple: true) #=> "Microcentrifuge"
|
138
|
+
#
|
139
|
+
# @faker.version next
|
140
|
+
def tool(simple: false)
|
141
|
+
tool = fetch('science.tool')
|
142
|
+
return tool if simple
|
143
|
+
|
144
|
+
# Makes sure the modifier are different
|
145
|
+
loop do
|
146
|
+
modifier = self.modifier
|
147
|
+
break unless tool.start_with?(modifier)
|
148
|
+
end
|
149
|
+
|
150
|
+
"#{modifier} #{tool}"
|
151
|
+
end
|
70
152
|
end
|
71
153
|
end
|
72
154
|
end
|
data/lib/faker/games/dota.rb
CHANGED
@@ -4,6 +4,19 @@ module Faker
|
|
4
4
|
class Games
|
5
5
|
class Dota < Base
|
6
6
|
class << self
|
7
|
+
##
|
8
|
+
# Produces the name of a building from Dota.
|
9
|
+
#
|
10
|
+
# @return [String]
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Faker::Games::Dota.building #=> "Tower"
|
14
|
+
#
|
15
|
+
# @faker.version 1.9.0
|
16
|
+
def building
|
17
|
+
fetch('games.dota.building')
|
18
|
+
end
|
19
|
+
|
7
20
|
##
|
8
21
|
# Produces the name of a hero from Dota.
|
9
22
|
#
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Faker
|
4
|
+
class Australia < Base
|
5
|
+
class << self
|
6
|
+
##
|
7
|
+
# Produces a location in Australia
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Faker::Australia.location
|
13
|
+
# #=> "Sydney"
|
14
|
+
#
|
15
|
+
# @faker.version next
|
16
|
+
def location
|
17
|
+
fetch('australia.locations')
|
18
|
+
end
|
19
|
+
|
20
|
+
# Produces an Australian animal
|
21
|
+
#
|
22
|
+
# @return [String]
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Faker::Australia.animal
|
26
|
+
# #=> "Dingo"
|
27
|
+
#
|
28
|
+
# @faker.version next
|
29
|
+
def animal
|
30
|
+
fetch('australia.animals')
|
31
|
+
end
|
32
|
+
|
33
|
+
# Produces an Australian State or Territory
|
34
|
+
#
|
35
|
+
# @return [String]
|
36
|
+
#
|
37
|
+
# @example
|
38
|
+
# Faker::Australia.state
|
39
|
+
# #=> "New South Wales"
|
40
|
+
#
|
41
|
+
# @faker.version next
|
42
|
+
def state
|
43
|
+
fetch('australia.states')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|