faker 2.1.2 → 2.4.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 +113 -7
- data/README.md +4 -4
- data/lib/faker.rb +56 -1
- data/lib/faker/blockchain/aeternity.rb +70 -0
- data/lib/faker/blockchain/bitcoin.rb +26 -0
- data/lib/faker/blockchain/ethereum.rb +10 -0
- data/lib/faker/blockchain/tezos.rb +62 -6
- data/lib/faker/books/book.rb +36 -0
- data/lib/faker/books/culture_series.rb +49 -0
- data/lib/faker/books/dune.rb +66 -5
- data/lib/faker/books/lovecraft.rb +210 -7
- data/lib/faker/creature/animal.rb +9 -0
- data/lib/faker/creature/cat.rb +27 -0
- data/lib/faker/creature/dog.rb +72 -0
- data/lib/faker/creature/horse.rb +18 -0
- data/lib/faker/default/address.rb +25 -5
- data/lib/faker/default/alphanumeric.rb +56 -7
- data/lib/faker/default/app.rb +54 -1
- data/lib/faker/default/appliance.rb +18 -0
- data/lib/faker/default/artist.rb +9 -0
- data/lib/faker/default/avatar.rb +42 -1
- data/lib/faker/default/bank.rb +10 -2
- data/lib/faker/default/boolean.rb +16 -1
- data/lib/faker/default/chile_rut.rb +12 -2
- data/lib/faker/default/code.rb +16 -3
- data/lib/faker/default/commerce.rb +17 -3
- data/lib/faker/default/company.rb +10 -2
- data/lib/faker/default/crypto_coin.rb +15 -3
- data/lib/faker/default/date.rb +37 -5
- data/lib/faker/default/demographic.rb +5 -1
- data/lib/faker/default/dessert.rb +27 -0
- data/lib/faker/default/device.rb +54 -0
- data/lib/faker/default/driving_licence.rb +10 -4
- data/lib/faker/default/electrical_components.rb +27 -0
- data/lib/faker/default/file.rb +19 -2
- data/lib/faker/default/fillmurray.rb +9 -1
- data/lib/faker/default/finance.rb +5 -1
- data/lib/faker/default/gender.rb +18 -0
- data/lib/faker/default/greek_philosophers.rb +18 -0
- data/lib/faker/default/hacker.rb +59 -1
- data/lib/faker/default/hipster.rb +45 -6
- data/lib/faker/default/house.rb +18 -0
- data/lib/faker/default/id_number.rb +11 -3
- data/lib/faker/default/industry_segments.rb +36 -0
- data/lib/faker/default/internet.rb +94 -13
- data/lib/faker/default/invoice.rb +16 -3
- data/lib/faker/default/json.rb +19 -2
- data/lib/faker/default/lorem.rb +81 -10
- data/lib/faker/default/lorem_flickr.rb +38 -5
- data/lib/faker/default/lorem_pixel.rb +10 -1
- data/lib/faker/default/markdown.rb +6 -1
- data/lib/faker/default/marketing.rb +9 -0
- data/lib/faker/default/measurement.rb +40 -8
- data/lib/faker/default/military.rb +45 -0
- data/lib/faker/default/name.rb +5 -1
- data/lib/faker/default/nato_phonetic_alphabet.rb +9 -0
- data/lib/faker/default/nhs.rb +5 -1
- data/lib/faker/default/number.rb +56 -11
- data/lib/faker/default/omniauth.rb +92 -9
- data/lib/faker/default/phone_number.rb +5 -1
- data/lib/faker/default/placeholdit.rb +11 -1
- data/lib/faker/default/programming_language.rb +18 -0
- data/lib/faker/default/relationship.rb +5 -1
- data/lib/faker/default/science.rb +27 -0
- data/lib/faker/default/source.rb +59 -3
- data/lib/faker/default/string.rb +5 -1
- data/lib/faker/default/stripe.rb +20 -4
- data/lib/faker/default/subscription.rb +45 -0
- data/lib/faker/default/superhero.rb +45 -0
- data/lib/faker/default/time.rb +37 -4
- data/lib/faker/default/twitter.rb +32 -18
- data/lib/faker/default/types.rb +27 -5
- data/lib/faker/default/vehicle.rb +17 -4
- data/lib/faker/default/world_cup.rb +11 -2
- data/lib/faker/games/dota.rb +52 -1
- data/lib/faker/games/elder_scrolls.rb +72 -0
- data/lib/faker/games/fallout.rb +37 -0
- data/lib/faker/games/game.rb +27 -0
- data/lib/faker/games/half_life.rb +27 -0
- data/lib/faker/games/heroes.rb +27 -0
- data/lib/faker/games/heroes_of_the_storm.rb +36 -0
- data/lib/faker/games/league_of_legends.rb +54 -0
- data/lib/faker/games/myst.rb +45 -0
- data/lib/faker/games/overwatch.rb +27 -0
- data/lib/faker/games/pokemon.rb +27 -0
- data/lib/faker/games/sonic_the_hedgehog.rb +27 -0
- data/lib/faker/games/super_smash_bros.rb +18 -0
- data/lib/faker/games/witcher.rb +54 -0
- data/lib/faker/games/world_of_warcraft.rb +18 -0
- data/lib/faker/games/zelda.rb +36 -0
- data/lib/faker/japanese_media/dragon_ball.rb +9 -0
- data/lib/faker/japanese_media/sword_art_online.rb +36 -0
- data/lib/faker/movies/hobbit.rb +37 -0
- data/lib/faker/movies/movie.rb +9 -0
- data/lib/faker/movies/star_wars.rb +6 -4
- data/lib/faker/music/grateful_dead.rb +18 -0
- data/lib/faker/music/phish.rb +9 -0
- data/lib/faker/music/rock_band.rb +9 -0
- data/lib/faker/tv_shows/breaking_bad.rb +18 -0
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en-CA.yml +1 -1
- data/lib/locales/en/science.yml +1 -1
- data/lib/locales/ja.yml +8 -9
- metadata +31 -14
data/lib/faker/books/book.rb
CHANGED
@@ -5,18 +5,54 @@ module Faker
|
|
5
5
|
flexible :book
|
6
6
|
|
7
7
|
class << self
|
8
|
+
##
|
9
|
+
# Produces a random book title
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::Book.title #=> "The Odd Sister"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.3
|
8
17
|
def title
|
9
18
|
fetch('book.title')
|
10
19
|
end
|
11
20
|
|
21
|
+
##
|
22
|
+
# Produces a random book author
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Faker::Book.author #=> "Alysha Olsen"
|
28
|
+
#
|
29
|
+
# @faker.version 1.9.3
|
12
30
|
def author
|
13
31
|
parse('book.author')
|
14
32
|
end
|
15
33
|
|
34
|
+
##
|
35
|
+
# Produces a random book publisher
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# Faker::Book.publisher #=> "Opus Reader"
|
41
|
+
#
|
42
|
+
# @faker.version 1.9.3
|
16
43
|
def publisher
|
17
44
|
fetch('book.publisher')
|
18
45
|
end
|
19
46
|
|
47
|
+
##
|
48
|
+
# Produces a random genre
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# Faker::Book.genre #=> "Mystery"
|
54
|
+
#
|
55
|
+
# @faker.version 1.9.3
|
20
56
|
def genre
|
21
57
|
fetch('book.genre')
|
22
58
|
end
|
@@ -4,27 +4,76 @@ module Faker
|
|
4
4
|
class Books
|
5
5
|
class CultureSeries < Base
|
6
6
|
flexible :culture_series
|
7
|
+
|
7
8
|
class << self
|
9
|
+
##
|
10
|
+
# @return [String]
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Faker::Books::CultureSeries.book
|
14
|
+
# #=> "The Player of Games"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.3
|
8
17
|
def book
|
9
18
|
fetch('culture_series.books')
|
10
19
|
end
|
11
20
|
|
21
|
+
##
|
22
|
+
# @return [String]
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Faker::Books::CultureSeries.culture_ship
|
26
|
+
# #=> "Fate Amenable To Change"
|
27
|
+
#
|
28
|
+
# @faker.version 1.9.3
|
12
29
|
def culture_ship
|
13
30
|
fetch('culture_series.culture_ships')
|
14
31
|
end
|
15
32
|
|
33
|
+
##
|
34
|
+
# @return [String]
|
35
|
+
#
|
36
|
+
# @example
|
37
|
+
# Faker::Books::CultureSeries.culture_ship_class
|
38
|
+
# #=> "General Systems Vehicle"
|
39
|
+
#
|
40
|
+
# @faker.version 1.9.3
|
16
41
|
def culture_ship_class
|
17
42
|
fetch('culture_series.culture_ship_classes')
|
18
43
|
end
|
19
44
|
|
45
|
+
##
|
46
|
+
# @return [String]
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
# Faker::Books::CultureSeries.culture_ship_class_abv
|
50
|
+
# #=> "The Odd Sister"
|
51
|
+
#
|
52
|
+
# @faker.version 1.9.3
|
20
53
|
def culture_ship_class_abv
|
21
54
|
fetch('culture_series.culture_ship_class_abvs')
|
22
55
|
end
|
23
56
|
|
57
|
+
##
|
58
|
+
# @return [String]
|
59
|
+
#
|
60
|
+
# @example
|
61
|
+
# Faker::Books::CultureSeries.civ
|
62
|
+
# #=> "Culture"
|
63
|
+
#
|
64
|
+
# @faker.version 1.9.3
|
24
65
|
def civ
|
25
66
|
fetch('culture_series.civs')
|
26
67
|
end
|
27
68
|
|
69
|
+
##
|
70
|
+
# @return [String]
|
71
|
+
#
|
72
|
+
# @example
|
73
|
+
# Faker::Books::CultureSeries.planet
|
74
|
+
# #=> "Xinth"
|
75
|
+
#
|
76
|
+
# @faker.version 1.9.3
|
28
77
|
def planet
|
29
78
|
fetch('culture_series.planets')
|
30
79
|
end
|
data/lib/faker/books/dune.rb
CHANGED
@@ -2,24 +2,67 @@
|
|
2
2
|
|
3
3
|
module Faker
|
4
4
|
class Books
|
5
|
+
##
|
6
|
+
# A Faker module beyond your dreams, test data beyond your imagination.
|
5
7
|
class Dune < Base
|
6
8
|
class << self
|
7
|
-
|
8
|
-
#
|
9
|
-
|
9
|
+
##
|
10
|
+
# Produces the name of a character from Dune
|
11
|
+
#
|
12
|
+
# @return [String]
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# Faker::Books::Dune.character #=> "Leto Atreides"
|
16
|
+
#
|
17
|
+
# @faker.version 1.9.3
|
10
18
|
def character
|
11
19
|
fetch('dune.characters')
|
12
20
|
end
|
13
21
|
|
22
|
+
##
|
23
|
+
# @return [String]
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# Faker::Books::Dune.title #=> "Duke"
|
27
|
+
#
|
28
|
+
# @faker.version 1.9.3
|
14
29
|
def title
|
15
30
|
fetch('dune.titles')
|
16
31
|
end
|
17
32
|
|
33
|
+
##
|
34
|
+
# Produces the name of a planet from Dune
|
35
|
+
#
|
36
|
+
# @return [String]
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# Faker::Books::Dune.planet #=> "Caladan"
|
40
|
+
#
|
41
|
+
# @faker.version 1.9.3
|
18
42
|
def planet
|
19
43
|
fetch('dune.planets')
|
20
44
|
end
|
21
45
|
|
22
|
-
|
46
|
+
##
|
47
|
+
# Produces a quote from Dune
|
48
|
+
#
|
49
|
+
# @param character [String] The name of the character that the quote should be from
|
50
|
+
#
|
51
|
+
# @return [String]
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# Faker::Books::Dune.quote
|
55
|
+
# #=> "A dead man, surely, no longer requires that water."
|
56
|
+
# @example
|
57
|
+
# Faker::Books::Dune.quote(character: "baron_harkonnen")
|
58
|
+
# #=> "He who controls the spice, controls the universe!"
|
59
|
+
#
|
60
|
+
# @faker.version 1.9.3
|
61
|
+
def quote(legacy_character = NOT_GIVEN, character: nil)
|
62
|
+
warn_for_deprecated_arguments do |keywords|
|
63
|
+
keywords << :character if legacy_character != NOT_GIVEN
|
64
|
+
end
|
65
|
+
|
23
66
|
quoted_characters = translate('faker.dune.quotes').keys
|
24
67
|
|
25
68
|
if character.nil?
|
@@ -36,7 +79,25 @@ module Faker
|
|
36
79
|
fetch('dune.quotes.' + character)
|
37
80
|
end
|
38
81
|
|
39
|
-
|
82
|
+
##
|
83
|
+
# Produces a saying from Dune
|
84
|
+
#
|
85
|
+
# @param source [String]
|
86
|
+
#
|
87
|
+
# @return [String]
|
88
|
+
#
|
89
|
+
# @example
|
90
|
+
# Faker::Books::Dune.saying #=> "You do not beg the sun for mercy."
|
91
|
+
# @example
|
92
|
+
# Faker::Books::Dune.saying(source: "fremen")
|
93
|
+
# #=> "May thy knife chip and shatter."
|
94
|
+
#
|
95
|
+
# @faker.version 1.9.3
|
96
|
+
def saying(legacy_source = NOT_GIVEN, source: nil)
|
97
|
+
warn_for_deprecated_arguments do |keywords|
|
98
|
+
keywords << :source if legacy_source != NOT_GIVEN
|
99
|
+
end
|
100
|
+
|
40
101
|
sourced_sayings = translate('faker.dune.sayings').keys
|
41
102
|
|
42
103
|
if source.nil?
|
@@ -4,32 +4,142 @@ module Faker
|
|
4
4
|
class Books
|
5
5
|
class Lovecraft < Base
|
6
6
|
class << self
|
7
|
+
##
|
8
|
+
# Produces the name of a location
|
9
|
+
#
|
10
|
+
# @return [String]
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Faker::Books::Lovecraft.location #=> "Kingsport"
|
14
|
+
#
|
15
|
+
# @faker.version 1.9.3
|
7
16
|
def location
|
8
17
|
fetch('lovecraft.location')
|
9
18
|
end
|
10
19
|
|
11
|
-
|
20
|
+
##
|
21
|
+
# @param number [Integer] The number of times to repeat the chant
|
22
|
+
# @return [String]
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Faker::Books::Lovecraft.fhtagn
|
26
|
+
# #=> "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn"
|
27
|
+
# @example
|
28
|
+
# Faker::Books::Lovecraft.fhtagn(number: 3)
|
29
|
+
# #=> "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fht...
|
30
|
+
#
|
31
|
+
# @faker.version 1.9.3
|
32
|
+
def fhtagn(legacy_number = NOT_GIVEN, number: 1)
|
33
|
+
warn_for_deprecated_arguments do |keywords|
|
34
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
35
|
+
end
|
36
|
+
|
12
37
|
Array.new(number) { fetch('lovecraft.fhtagn') }.join('. ')
|
13
38
|
end
|
14
39
|
|
40
|
+
##
|
41
|
+
# Produces the name of a deity
|
42
|
+
#
|
43
|
+
# @return [String]
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
# Faker::Books::Lovecraft.deity #=> "Shub-Niggurath"
|
47
|
+
#
|
48
|
+
# @faker.version 1.9.3
|
15
49
|
def deity
|
16
50
|
fetch('lovecraft.deity')
|
17
51
|
end
|
18
52
|
|
53
|
+
##
|
54
|
+
# Produces the name of a tome
|
55
|
+
#
|
56
|
+
# @return [String]
|
57
|
+
#
|
58
|
+
# @example
|
59
|
+
# Faker::Books::Lovecraft.tome #=> "Book of Eibon"
|
60
|
+
#
|
61
|
+
# @faker.version 1.9.3
|
19
62
|
def tome
|
20
63
|
fetch('lovecraft.tome')
|
21
64
|
end
|
22
65
|
|
23
|
-
|
66
|
+
##
|
67
|
+
# Produces a random sentence
|
68
|
+
#
|
69
|
+
# @param word_count [Integer] The number of words to have in the sentence
|
70
|
+
# @param random_words_to_add [Integer]
|
71
|
+
#
|
72
|
+
# @return [String]
|
73
|
+
#
|
74
|
+
# @example
|
75
|
+
# Faker::Books::Lovecraft.sentence
|
76
|
+
# #=> "Furtive antiquarian squamous dank cat loathsome amorphous lurk."
|
77
|
+
# @example
|
78
|
+
# Faker::Books::Lovecraft.sentence(word_count: 3)
|
79
|
+
# #=> "Daemoniac antediluvian fainted squamous comprehension gambrel nameless singular."
|
80
|
+
# @example
|
81
|
+
# Faker::Books::Lovecraft.sentence(word_count: 3, random_words_to_add: 1)
|
82
|
+
# #=> "Amorphous indescribable tenebrous."
|
83
|
+
#
|
84
|
+
# @faker.version 1.9.3
|
85
|
+
def sentence(legacy_word_count = NOT_GIVEN, legacy_random_words_to_add = NOT_GIVEN, word_count: 4, random_words_to_add: 6)
|
86
|
+
warn_for_deprecated_arguments do |keywords|
|
87
|
+
keywords << :word_count if legacy_word_count != NOT_GIVEN
|
88
|
+
keywords << :random_words_to_add if legacy_random_words_to_add != NOT_GIVEN
|
89
|
+
end
|
90
|
+
|
24
91
|
words(number: word_count + rand(random_words_to_add.to_i).to_i, spaces_allowed: true).join(' ').capitalize + '.'
|
25
92
|
end
|
26
93
|
|
94
|
+
##
|
95
|
+
# Produces a random word
|
96
|
+
#
|
97
|
+
# @return [String]
|
98
|
+
#
|
99
|
+
# @example
|
100
|
+
# Faker::Books::Lovecraft.word #=> "furtive"
|
101
|
+
#
|
102
|
+
# @faker.version 1.9.3
|
27
103
|
def word
|
28
104
|
random_word = sample(translate('faker.lovecraft.words'))
|
29
105
|
random_word =~ /\s/ ? word : random_word
|
30
106
|
end
|
31
107
|
|
32
|
-
|
108
|
+
##
|
109
|
+
# Produces a array of random words
|
110
|
+
#
|
111
|
+
# @param number [Integer] Number of words to generate
|
112
|
+
# @param spaces_allowed [Boolean] If true, generated words can contain spaces
|
113
|
+
#
|
114
|
+
# @return [Array<String>]
|
115
|
+
#
|
116
|
+
# @example
|
117
|
+
# Faker::Books::Lovecraft.words
|
118
|
+
# #=> [
|
119
|
+
# # "manuscript",
|
120
|
+
# # "abnormal",
|
121
|
+
# # "singular",
|
122
|
+
# # ]
|
123
|
+
# @example
|
124
|
+
# Faker::Books::Lovecraft.words(number: 2)
|
125
|
+
# #=> [
|
126
|
+
# # "daemoniac",
|
127
|
+
# # "cat",
|
128
|
+
# # ]
|
129
|
+
# @example
|
130
|
+
# Faker::Books::Lovecraft.words(number: 2, spaces_allowed: 1)
|
131
|
+
# #=> [
|
132
|
+
# # "lurk",
|
133
|
+
# # "charnel",
|
134
|
+
# # ]
|
135
|
+
#
|
136
|
+
# @faker.version 1.9.3
|
137
|
+
def words(legacy_number = NOT_GIVEN, legacy_spaces_allowed = NOT_GIVEN, number: 3, spaces_allowed: false)
|
138
|
+
warn_for_deprecated_arguments do |keywords|
|
139
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
140
|
+
keywords << :spaces_allowed if legacy_spaces_allowed != NOT_GIVEN
|
141
|
+
end
|
142
|
+
|
33
143
|
resolved_num = resolve(number)
|
34
144
|
word_list = translate('faker.lovecraft.words')
|
35
145
|
word_list *= ((resolved_num / word_list.length) + 1)
|
@@ -40,7 +150,33 @@ module Faker
|
|
40
150
|
words.each_with_index { |w, i| words[i] = word if w =~ /\s/ }
|
41
151
|
end
|
42
152
|
|
43
|
-
|
153
|
+
##
|
154
|
+
# Produces a array of random sentences
|
155
|
+
#
|
156
|
+
# @param number [Integer] Number of sentences to generate
|
157
|
+
#
|
158
|
+
# @return [Array<String>]
|
159
|
+
#
|
160
|
+
# @example
|
161
|
+
# Faker::Books::Lovecraft.sentences
|
162
|
+
# #=> [
|
163
|
+
# # "Nameless loathsome decadent gambrel.",
|
164
|
+
# # "Ululate swarthy immemorial cat madness gibbous unmentionable unnamable.",
|
165
|
+
# # "Decadent antediluvian non-euclidean tentacles amorphous tenebrous.",
|
166
|
+
# # ]
|
167
|
+
# @example
|
168
|
+
# Faker::Books::Lovecraft.sentences(number: 2)
|
169
|
+
# #=> [
|
170
|
+
# # "Antediluvian amorphous unmentionable singular accursed squamous immemorial.",
|
171
|
+
# # "Gambrel daemoniac gibbous stygian shunned ululate iridescence abnormal.",
|
172
|
+
# # ]
|
173
|
+
#
|
174
|
+
# @faker.version 1.9.3
|
175
|
+
def sentences(legacy_number = NOT_GIVEN, number: 3)
|
176
|
+
warn_for_deprecated_arguments do |keywords|
|
177
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
178
|
+
end
|
179
|
+
|
44
180
|
[].tap do |sentences|
|
45
181
|
1.upto(resolve(number)) do
|
46
182
|
sentences << sentence(word_count: 3)
|
@@ -48,11 +184,61 @@ module Faker
|
|
48
184
|
end
|
49
185
|
end
|
50
186
|
|
51
|
-
|
187
|
+
##
|
188
|
+
# Produces a random paragraph
|
189
|
+
#
|
190
|
+
# @param sentence_count [Integer] Number of sentences to generate
|
191
|
+
# @param random_sentences_to_add [Integer]
|
192
|
+
#
|
193
|
+
# @return [String]
|
194
|
+
#
|
195
|
+
# @example
|
196
|
+
# Faker::Books::Lovecraft.paragraph
|
197
|
+
# #=> "Squamous nameless daemoniac fungus ululate. Cyclopean stygian decadent loathsome manuscript tenebrous. Foetid abnormal stench. Dank non-euclidean comprehension eldritch. Charnel singular shunned lurk effulgence fungus."
|
198
|
+
# @example
|
199
|
+
# Faker::Books::Lovecraft.paragraph(sentence_count: 2)
|
200
|
+
# #=> "Decadent lurk tenebrous loathsome furtive spectral amorphous gibbous. Gambrel eldritch daemoniac cat madness comprehension stygian effulgence."
|
201
|
+
# @example
|
202
|
+
# Faker::Books::Lovecraft.paragraph(sentence_count: 1, random_sentences_to_add: 1)
|
203
|
+
# #=> "Stench cyclopean fainted antiquarian nameless. Antiquarian ululate tenebrous non-euclidean effulgence."
|
204
|
+
#
|
205
|
+
# @faker.version 1.9.3
|
206
|
+
def paragraph(legacy_sentence_count = NOT_GIVEN, legacy_random_sentences_to_add = NOT_GIVEN, sentence_count: 3, random_sentences_to_add: 3)
|
207
|
+
warn_for_deprecated_arguments do |keywords|
|
208
|
+
keywords << :sentence_count if legacy_sentence_count != NOT_GIVEN
|
209
|
+
keywords << :random_sentences_to_add if legacy_random_sentences_to_add != NOT_GIVEN
|
210
|
+
end
|
211
|
+
|
52
212
|
sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i).to_i).join(' ')
|
53
213
|
end
|
54
214
|
|
55
|
-
|
215
|
+
##
|
216
|
+
# Produces a array of random paragraphs
|
217
|
+
#
|
218
|
+
# @param number [Integer] Number of paragraphs to generate
|
219
|
+
#
|
220
|
+
# @return [Array<String>]
|
221
|
+
#
|
222
|
+
# @example
|
223
|
+
# Faker::Books::Lovecraft.paragraphs
|
224
|
+
# #=> [
|
225
|
+
# # "Noisome daemoniac gibbous abnormal antediluvian. Unutterable fung...
|
226
|
+
# # "Non-euclidean immemorial indescribable accursed furtive. Dank unn...
|
227
|
+
# # "Charnel antediluvian unnamable cat blasphemous comprehension tene...
|
228
|
+
# # ]
|
229
|
+
# @example
|
230
|
+
# Faker::Books::Lovecraft.paragraphs(number: 2)
|
231
|
+
# #=> [
|
232
|
+
# # "Hideous amorphous manuscript antediluvian non-euclidean cat eldri...
|
233
|
+
# # "Tenebrous unnamable comprehension antediluvian lurk. Lurk spectra...
|
234
|
+
# # ]
|
235
|
+
#
|
236
|
+
# @faker.version 1.9.3
|
237
|
+
def paragraphs(legacy_number = NOT_GIVEN, number: 3)
|
238
|
+
warn_for_deprecated_arguments do |keywords|
|
239
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
240
|
+
end
|
241
|
+
|
56
242
|
[].tap do |paragraphs|
|
57
243
|
1.upto(resolve(number)) do
|
58
244
|
paragraphs << paragraph(sentence_count: 3)
|
@@ -60,7 +246,24 @@ module Faker
|
|
60
246
|
end
|
61
247
|
end
|
62
248
|
|
63
|
-
|
249
|
+
##
|
250
|
+
# @param characters [Integer] Number of characters to generate in the paragraph
|
251
|
+
#
|
252
|
+
# @return [String]
|
253
|
+
#
|
254
|
+
# @example
|
255
|
+
# Faker::Books::Lovecraft.paragraph_by_chars
|
256
|
+
# #=> "Truffaut stumptown trust fund 8-bit messenger bag portland. Meh kombucha selvage swag biodiesel. Lomo kinfolk jean shorts asymmetrical diy. Wayfarers portland twee stumptown. Wes anderson biodiesel retro 90's pabst. Diy echo 90's mixtape semiotics. Cornho."
|
257
|
+
# @example
|
258
|
+
# Faker::Books::Lovecraft.paragraph_by_chars(characters: 128)
|
259
|
+
# #=> "Effulgence madness noisome. Fungus stygian mortal madness amorphous dank. Decadent noisome hideous effulgence. Tentacles charne."
|
260
|
+
#
|
261
|
+
# @faker.version 1.9.3
|
262
|
+
def paragraph_by_chars(legacy_characters = NOT_GIVEN, characters: 256)
|
263
|
+
warn_for_deprecated_arguments do |keywords|
|
264
|
+
keywords << :characters if legacy_characters != NOT_GIVEN
|
265
|
+
end
|
266
|
+
|
64
267
|
paragraph = paragraph(sentence_count: 3)
|
65
268
|
|
66
269
|
paragraph += ' ' + paragraph(sentence_count: 3) while paragraph.length < characters
|