faker 2.2.2 → 2.3.0

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/README.md +0 -1
  4. data/lib/faker/blockchain/bitcoin.rb +26 -0
  5. data/lib/faker/blockchain/ethereum.rb +10 -0
  6. data/lib/faker/blockchain/tezos.rb +56 -0
  7. data/lib/faker/books/book.rb +36 -0
  8. data/lib/faker/books/culture_series.rb +49 -0
  9. data/lib/faker/books/dune.rb +56 -3
  10. data/lib/faker/books/lovecraft.rb +172 -0
  11. data/lib/faker/creature/animal.rb +9 -0
  12. data/lib/faker/creature/cat.rb +27 -0
  13. data/lib/faker/creature/dog.rb +72 -0
  14. data/lib/faker/creature/horse.rb +18 -0
  15. data/lib/faker/default/alphanumeric.rb +23 -6
  16. data/lib/faker/default/app.rb +45 -0
  17. data/lib/faker/default/artist.rb +9 -0
  18. data/lib/faker/default/avatar.rb +31 -0
  19. data/lib/faker/default/boolean.rb +12 -1
  20. data/lib/faker/default/gender.rb +18 -0
  21. data/lib/faker/default/hacker.rb +59 -1
  22. data/lib/faker/default/house.rb +18 -0
  23. data/lib/faker/default/internet.rb +15 -10
  24. data/lib/faker/default/lorem.rb +8 -7
  25. data/lib/faker/default/omniauth.rb +42 -0
  26. data/lib/faker/default/programming_language.rb +18 -0
  27. data/lib/faker/default/source.rb +43 -2
  28. data/lib/faker/games/elder_scrolls.rb +72 -0
  29. data/lib/faker/games/fallout.rb +37 -0
  30. data/lib/faker/games/game.rb +27 -0
  31. data/lib/faker/games/half_life.rb +27 -0
  32. data/lib/faker/games/overwatch.rb +27 -0
  33. data/lib/faker/games/super_smash_bros.rb +18 -0
  34. data/lib/faker/games/zelda.rb +36 -0
  35. data/lib/faker/tv_shows/breaking_bad.rb +18 -0
  36. data/lib/faker/version.rb +1 -1
  37. data/lib/locales/en-CA.yml +1 -1
  38. data/lib/locales/ja.yml +1 -1
  39. metadata +19 -3
@@ -4,6 +4,15 @@ module Faker
4
4
  class Creature
5
5
  class Animal < Base
6
6
  class << self
7
+ ##
8
+ # Produces a random animal name
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @example
13
+ # Faker::Creature::Animal.name #=> "fly"
14
+ #
15
+ # @faker.version 1.9.2
7
16
  def name
8
17
  fetch('creature.animal.name')
9
18
  end
@@ -6,14 +6,41 @@ module Faker
6
6
  flexible :cat
7
7
 
8
8
  class << self
9
+ ##
10
+ # Produces a random name for a cat
11
+ #
12
+ # @return [String]
13
+ #
14
+ # @example
15
+ # Faker::Creature::Cat.name #=> "Felix"
16
+ #
17
+ # @faker.version 1.9.2
9
18
  def name
10
19
  fetch('creature.cat.name')
11
20
  end
12
21
 
22
+ ##
23
+ # Produces a random cat breed
24
+ #
25
+ # @return [String]
26
+ #
27
+ # @example
28
+ # Faker::Creature::Cat.breed #=> "Scottish Fold"
29
+ #
30
+ # @faker.version 1.9.2
13
31
  def breed
14
32
  fetch('creature.cat.breed')
15
33
  end
16
34
 
35
+ ##
36
+ # Produces a random cat breed registry
37
+ #
38
+ # @return [String]
39
+ #
40
+ # @example
41
+ # Faker::Creature::Cat.registry #=> "Fancy Southern Africa Cat Council"
42
+ #
43
+ # @faker.version 1.9.2
17
44
  def registry
18
45
  fetch('creature.cat.registry')
19
46
  end
@@ -6,34 +6,106 @@ module Faker
6
6
  flexible :dog
7
7
 
8
8
  class << self
9
+ ##
10
+ # Produces a random name for a dog
11
+ #
12
+ # @return [String]
13
+ #
14
+ # @example
15
+ # Faker::Creature::Dog.name #=> "Spike"
16
+ #
17
+ # @faker.version 1.9.2
9
18
  def name
10
19
  fetch('creature.dog.name')
11
20
  end
12
21
 
22
+ ##
23
+ # Produces a random dog breed
24
+ #
25
+ # @return [String]
26
+ #
27
+ # @example
28
+ # Faker::Creature::Dog.breed #=> "Yorkshire Terrier"
29
+ #
30
+ # @faker.version 1.9.2
13
31
  def breed
14
32
  fetch('creature.dog.breed')
15
33
  end
16
34
 
35
+ ##
36
+ # Produces a random sound made by a dog
37
+ #
38
+ # @return [String]
39
+ #
40
+ # @example
41
+ # Faker::Creature::Dog.sound #=> "woof woof"
42
+ #
43
+ # @faker.version 1.9.2
17
44
  def sound
18
45
  fetch('creature.dog.sound')
19
46
  end
20
47
 
48
+ ##
49
+ # Produces a random dog meme phrase
50
+ #
51
+ # @return [String]
52
+ #
53
+ # @example
54
+ # Faker::Creature::Dog.meme_phrase #=> "smol pupperino"
55
+ #
56
+ # @faker.version 1.9.2
21
57
  def meme_phrase
22
58
  fetch('creature.dog.meme_phrase')
23
59
  end
24
60
 
61
+ ##
62
+ # Produces a random dog age
63
+ #
64
+ # @return [String]
65
+ #
66
+ # @example
67
+ # Faker::Creature::Dog.age #=> "puppy"
68
+ #
69
+ # @faker.version 1.9.2
25
70
  def age
26
71
  fetch('creature.dog.age')
27
72
  end
28
73
 
74
+ ##
75
+ # Produces a random gender
76
+ #
77
+ # @return [String]
78
+ #
79
+ # @example
80
+ # Faker::Creature::Dog.gender #=> "Female"
81
+ #
82
+ # @faker.version 1.9.2
29
83
  def gender
30
84
  Faker::Gender.binary_type
31
85
  end
32
86
 
87
+ ##
88
+ # Produces a random coat length
89
+ #
90
+ # @return [String]
91
+ #
92
+ # @example
93
+ # Faker::Creature::Dog.coat_length #=> "short"
94
+ #
95
+ # @faker.version 1.9.2
33
96
  def coat_length
34
97
  fetch('creature.dog.coat_length')
35
98
  end
36
99
 
100
+ ##
101
+ # Produces a random size of a dog
102
+ #
103
+ # @return [String]
104
+ #
105
+ # @example
106
+ # Faker::Creature::Dog.size #=> "small"
107
+ #
108
+ # @faker.version 1.9.2
37
109
  def size
38
110
  fetch('creature.dog.size')
39
111
  end
@@ -6,10 +6,28 @@ module Faker
6
6
  flexible :horse
7
7
 
8
8
  class << self
9
+ ##
10
+ # Produces a random name for a horse
11
+ #
12
+ # @return [String]
13
+ #
14
+ # @example
15
+ # Faker::Creature::Horse.name #=> "Noir"
16
+ #
17
+ # @faker.version 1.9.2
9
18
  def name
10
19
  fetch('creature.horse.name')
11
20
  end
12
21
 
22
+ ##
23
+ # Produces a random horse breed
24
+ #
25
+ # @return [String]
26
+ #
27
+ # @example
28
+ # Faker::Creature::Horse.breed #=> "Spanish Barb see Barb Horse"
29
+ #
30
+ # @faker.version 1.9.2
13
31
  def breed
14
32
  fetch('creature.horse.breed')
15
33
  end
@@ -2,9 +2,23 @@
2
2
 
3
3
  module Faker
4
4
  class Alphanumeric < Base
5
+ ##
6
+ # List of characters allowed for alphanumeric strings
7
+ # @private
5
8
  ALPHANUMS = LLetters + Numbers
6
9
 
7
10
  class << self
11
+ ##
12
+ # Produces a random string of alphabetic characters (no digits)
13
+ #
14
+ # @param number [Integer] The length of the string to generate
15
+ #
16
+ # @return [String]
17
+ #
18
+ # @example
19
+ # Faker::Alphanumeric.alpha(number: 10) #=> "zlvubkrwga"
20
+ #
21
+ # @faker.version 1.9.2
8
22
  def alpha(legacy_number = NOT_GIVEN, number: 32)
9
23
  warn_for_deprecated_arguments do |keywords|
10
24
  keywords << :number if legacy_number != NOT_GIVEN
@@ -18,15 +32,18 @@ module Faker
18
32
  ##
19
33
  # Produces a random string of alphanumeric characters
20
34
  #
21
- # @param [Integer] number
22
- # @param [Integer] min_alpha
23
- # @param [Integer] min_numeric
35
+ # @param number [Integer] The number of characters to generate
36
+ # @param min_alpha [Integer] The minimum number of alphabetic to add to the string
37
+ # @param min_numeric [Integer] The minimum number of numbers to add to the string
24
38
  #
25
39
  # @return [String]
26
40
  #
27
- # @example Faker::Alphanumeric.alphanumeric(number: 10) #=> "3yfq2phxtb"
28
- # @example Faker::Alphanumeric.alphanumeric(number: 10, min_alpha: 3) #=> "3yfq2phxtb"
29
- # @example Faker::Alphanumeric.alphanumeric(number: 10, min_alpha: 3, min_numeric: 3) #=> "3yfq2phx8b"
41
+ # @example
42
+ # Faker::Alphanumeric.alphanumeric(number: 10) #=> "3yfq2phxtb"
43
+ # @example
44
+ # Faker::Alphanumeric.alphanumeric(number: 10, min_alpha: 3) #=> "3yfq2phxtb"
45
+ # @example
46
+ # Faker::Alphanumeric.alphanumeric(number: 10, min_alpha: 3, min_numeric: 3) #=> "3yfq2phx8b"
30
47
  #
31
48
  # @faker.version 2.1.3
32
49
  def alphanumeric(legacy_number = NOT_GIVEN, number: 32, min_alpha: 0, min_numeric: 0)
@@ -3,18 +3,63 @@
3
3
  module Faker
4
4
  class App < Base
5
5
  class << self
6
+ ##
7
+ # Produces an app name.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::App.name #=> "Treeflex"
13
+ #
14
+ # @faker.version 1.4.3
6
15
  def name
7
16
  fetch('app.name')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces a version string.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::App.version #=> "1.85"
26
+ #
27
+ # @faker.version 1.4.3
10
28
  def version
11
29
  parse('app.version')
12
30
  end
13
31
 
32
+ ##
33
+ # Produces the name of an app's author.
34
+ #
35
+ # @return [String]
36
+ #
37
+ # @example
38
+ # Faker::App.author #=> "Daphne Swift"
39
+ #
40
+ # @faker.version 1.4.3
14
41
  def author
15
42
  parse('app.author')
16
43
  end
17
44
 
45
+ ##
46
+ # Produces a String representing a semantic version identifier.
47
+ #
48
+ # @param major [Integer, Range] An integer to use or a range to pick the integer from.
49
+ # @param minor [Integer, Range] An integer to use or a range to pick the integer from.
50
+ # @param patch [Integer, Range] An integer to use or a range to pick the integer from.
51
+ # @return [String]
52
+ #
53
+ # @example
54
+ # Faker::App.semantic_version #=> "3.2.5"
55
+ # @example
56
+ # Faker::App.semantic_version(major: 42) #=> "42.5.2"
57
+ # @example
58
+ # Faker::App.semantic_version(minor: 100..101) #=> "42.100.4"
59
+ # @example
60
+ # Faker::App.semantic_version(patch: 5..6) #=> "7.2.6"
61
+ #
62
+ # @faker.version 1.4.3
18
63
  # rubocop:disable Metrics/ParameterLists
19
64
  def semantic_version(legacy_major = NOT_GIVEN, legacy_minor = NOT_GIVEN, legacy_patch = NOT_GIVEN, major: 0..9, minor: 0..9, patch: 1..9)
20
65
  # rubocop:enable Metrics/ParameterLists
@@ -3,6 +3,15 @@
3
3
  module Faker
4
4
  class Artist < Base
5
5
  class << self
6
+ ##
7
+ # Produces the name of an artist.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::Artist.name #=> "Michelangelo"
13
+ #
14
+ # @faker.version 1.8.8
6
15
  def name
7
16
  fetch('artist.names')
8
17
  end
@@ -3,8 +3,39 @@
3
3
  module Faker
4
4
  class Avatar < Base
5
5
  class << self
6
+ # @private
6
7
  SUPPORTED_FORMATS = %w[png jpg bmp].freeze
7
8
 
9
+ ##
10
+ # Produces a URL for an avatar from robohash.org
11
+ #
12
+ # @param slug [String, nil]
13
+ # @param size [String] image size in pixels, in the format of 'AxB'
14
+ # @param format [String] The image file format
15
+ # @param set [String] The avatar set to use
16
+ # @param bgset [String, nil] The background set to use
17
+ # @return [String] A robohash.org URL
18
+ #
19
+ # @example
20
+ # Faker::Avatar.image
21
+ # #=> "https://robohash.org/sitsequiquia.png?size=300x300&set=set1"
22
+ # @example
23
+ # Faker::Avatar.image(slug: "my-own-slug")
24
+ # #=> "https://robohash.org/my-own-slug.png?size=300x300&set=set1"
25
+ # @example
26
+ # Faker::Avatar.image(slug: "my-own-slug", size: "50x50")
27
+ # #=> "https://robohash.org/my-own-slug.png?size=50x50&set=set1"
28
+ # @example
29
+ # Faker::Avatar.image(slug: "my-own-slug", size: "50x50", format: "jpg")
30
+ # #=> "https://robohash.org/my-own-slug.jpg?size=50x50&set=set1"
31
+ # @example
32
+ # Faker::Avatar.image(slug: "my-own-slug", size: "50x50", format: "bmp")
33
+ # #=> "https://robohash.org/my-own-slug.bmp?size=50x50&set=set1"
34
+ # @example
35
+ # Faker::Avatar.image(slug: "my-own-slug", size: "50x50", format: "bmp", set: "set1", bgset: "bg1")
36
+ # #=> "https://robohash.org/my-own-slug.bmp?size=50x50&set=set1&bgset=bg1"
37
+ #
38
+ # @faker.version 1.4.3
8
39
  # rubocop:disable Metrics/ParameterLists
9
40
  def image(legacy_slug = NOT_GIVEN, legacy_size = NOT_GIVEN, legacy_format = NOT_GIVEN, legacy_set = NOT_GIVEN, legacy_bgset = NOT_GIVEN, slug: nil, size: '300x300', format: 'png', set: 'set1', bgset: nil)
10
41
  # rubocop:enable Metrics/ParameterLists
@@ -3,11 +3,22 @@
3
3
  module Faker
4
4
  class Boolean < Base
5
5
  class << self
6
+ ##
7
+ # Produces a boolean
8
+ #
9
+ # @param true_ratio [Float] The likelihood (as a float, out of 1.0) for the method to return `true`.
10
+ # @return [Boolean]
11
+ #
12
+ # @example
13
+ # Faker::Boolean.boolean #=> true
14
+ # @example
15
+ # Faker::Boolean.boolean(true_ratio: 0.2) #=> false
16
+ #
17
+ # @faker.version 1.6.2
6
18
  def boolean(legacy_true_ratio = NOT_GIVEN, true_ratio: 0.5)
7
19
  warn_for_deprecated_arguments do |keywords|
8
20
  keywords << :true_ratio if legacy_true_ratio != NOT_GIVEN
9
21
  end
10
-
11
22
  (rand < true_ratio)
12
23
  end
13
24
  end
@@ -3,10 +3,28 @@
3
3
  module Faker
4
4
  class Gender < Base
5
5
  class << self
6
+ ##
7
+ # Produces the name of a gender identity.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::Gender.type #=> "Non-binary"
13
+ #
14
+ # @faker.version 1.9.0
6
15
  def type
7
16
  fetch('gender.types')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces either 'Male' or 'Female'.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Gender.binary_type #=> "Female"
26
+ #
27
+ # @faker.version 1.9.0
10
28
  def binary_type
11
29
  fetch('gender.binary_types')
12
30
  end
@@ -1,35 +1,93 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Port of http://shinytoylabs.com/jargon/
4
3
  module Faker
4
+ # Port of http://shinytoylabs.com/jargon/
5
+ # Are you having trouble writing tech-savvy dialogue for your latest screenplay?
6
+ # Worry not! Hollywood-grade technical talk is ready to fill out any form where you need to look smart.
5
7
  class Hacker < Base
6
8
  flexible :hacker
7
9
 
8
10
  class << self
11
+ ##
12
+ # Produces something smart.
13
+ #
14
+ # @return [String]
15
+ #
16
+ # @example
17
+ # Faker::Hacker.say_something_smart
18
+ # #=> "Try to compress the SQL interface, maybe it will program the back-end hard drive!"
19
+ #
20
+ # @faker.version 1.4.0
9
21
  def say_something_smart
10
22
  sample(phrases)
11
23
  end
12
24
 
25
+ ##
26
+ # Short technical abbreviations.
27
+ #
28
+ # @return [String]
29
+ #
30
+ # @example
31
+ # Faker::Hacker.abbreviation #=> "RAM"
32
+ #
33
+ # @faker.version 1.4.0
13
34
  def abbreviation
14
35
  fetch('hacker.abbreviation')
15
36
  end
16
37
 
38
+ ##
39
+ # Hacker-centric adjectives.
40
+ #
41
+ # @return [String]
42
+ #
43
+ # @example
44
+ # Faker::Hacker.adjective #=> "open-source"
45
+ #
46
+ # @faker.version 1.4.0
17
47
  def adjective
18
48
  fetch('hacker.adjective')
19
49
  end
20
50
 
51
+ ##
52
+ # Only the best hacker-related nouns.
53
+ #
54
+ # @return [String]
55
+ #
56
+ # @example
57
+ # Faker::Hacker.noun #=> "bandwidth"
58
+ #
59
+ # @faker.version 1.4.0
21
60
  def noun
22
61
  fetch('hacker.noun')
23
62
  end
24
63
 
64
+ ##
65
+ # Actions that hackers take.
66
+ #
67
+ # @return [String]
68
+ #
69
+ # @example
70
+ # Faker::Hacker.verb #=> "bypass"
71
+ #
72
+ # @faker.version 1.4.0
25
73
  def verb
26
74
  fetch('hacker.verb')
27
75
  end
28
76
 
77
+ ##
78
+ # Produces a verb that ends with '-ing'.
79
+ #
80
+ # @return [String]
81
+ #
82
+ # @example
83
+ # Faker::Hacker.ingverb #=> "synthesizing"
84
+ #
85
+ # @faker.version 1.4.0
29
86
  def ingverb
30
87
  fetch('hacker.ingverb')
31
88
  end
32
89
 
90
+ # @private
33
91
  def phrases
34
92
  ["If we #{verb} the #{noun}, we can get to the #{abbreviation} #{noun} through the #{adjective} #{abbreviation} #{noun}!",
35
93
  "We need to #{verb} the #{adjective} #{abbreviation} #{noun}!",