-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate ::Dune and ::Lovecraft #1503
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
30d636d
Deprecate ::Dune
vbrazo 050fe08
Deprecate ::Lovecraft
vbrazo 88f25cb
Update CHANGELOG.md
vbrazo 62514c1
Update unreleased_README.md
vbrazo cea8e6e
Move Faker::Book to Books namespace
vbrazo a28282f
Remove doc/unreleased/default/dune.md
vbrazo c037523
Merge branch 'master' into features/add-books-namespace
vbrazo b5d236d
Fix tests after merging with master
vbrazo 5e812af
Add Faker::Books::Lovecraft.fhtagn missing documentation
vbrazo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Faker::Books::Dune | ||
|
||
### A Faker module beyond your dreams, test data beyond your imagination. | ||
|
||
```ruby | ||
Faker::Books::Dune.character #=> "Leto Atreides" | ||
|
||
Faker::Books::Dune.title #=> "Duke" | ||
|
||
Faker::Books::Dune.planet #=> "Caladan" | ||
|
||
Faker::Books::Dune.quote #=> "A dead man, surely, no longer requires that water." | ||
|
||
Faker::Books::Dune.quote("baron_harkonnen") #=> "He who controls the spice, controls the universe!" | ||
|
||
Faker::Books::Dune.saying #=> "You do not beg the sun for mercy." | ||
|
||
Faker::Books::Dune.saying("fremen") #=> "May thy knife chip and shatter." | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Faker::Books::Lovecraft | ||
|
||
```ruby | ||
Faker::Books::Lovecraft.fhtagn(3) #=> "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn. Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn. Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn" | ||
|
||
Faker::Books::Lovecraft.deity #=> "Shub-Niggurath" | ||
|
||
Faker::Books::Lovecraft.tome #=> "Book of Eibon" | ||
|
||
Faker::Books::Lovecraft.location #=> "Kingsport" | ||
|
||
Faker::Books::Lovecraft.word #=> "furtive" | ||
|
||
# Optional arguments: word_count=4, random_words_to_add=6 | ||
Faker::Books::Lovecraft.sentence #=> "Furtive antiquarian squamous dank cat loathsome amorphous lurk." | ||
Faker::Books::Lovecraft.sentence(3) #=> "Daemoniac antediluvian fainted squamous comprehension gambrel nameless singular." | ||
Faker::Books::Lovecraft.sentence(3, 1) #=> "Amorphous indescribable tenebrous." | ||
|
||
# Optional arguments: num=3, spaces_allowed = false | ||
Faker::Books::Lovecraft.words #=> ["manuscript", "abnormal", "singular"] | ||
Faker::Books::Lovecraft.words(2) #=> ["daemoniac", "cat"] | ||
Faker::Books::Lovecraft.words(2, true) #=> ["lurk", "charnel"] | ||
|
||
# Optional arguments: sentence_count=3 | ||
Faker::Books::Lovecraft.sentences #=> ["Nameless loathsome decadent gambrel.", "Ululate swarthy immemorial cat madness gibbous unmentionable unnamable.", "Decadent antediluvian non-euclidean tentacles amorphous tenebrous."] | ||
Faker::Books::Lovecraft.sentences(2) #=> ["Antediluvian amorphous unmentionable singular accursed squamous immemorial.", "Gambrel daemoniac gibbous stygian shunned ululate iridescence abnormal."] | ||
|
||
# Optional arguments: sentence_count=3, random_sentences_to_add=3 | ||
Faker::Books::Lovecraft.paragraph #=> "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." | ||
Faker::Books::Lovecraft.paragraph(2) #=> "Decadent lurk tenebrous loathsome furtive spectral amorphous gibbous. Gambrel eldritch daemoniac cat madness comprehension stygian effulgence." | ||
Faker::Books::Lovecraft.paragraph(2, 1) #=> "Stench cyclopean fainted antiquarian nameless. Antiquarian ululate tenebrous non-euclidean effulgence." | ||
|
||
# Optional arguments: paragraph_count=3 | ||
Faker::Books::Lovecraft.paragraphs #=> ["Noisome daemoniac gibbous abnormal antediluvian. Unutterable fungus accursed stench noisome lurk madness indescribable. Antiquarian fungus gibbering lurk dank fainted. Hideous loathsome manuscript daemoniac lurk charnel foetid.", "Non-euclidean immemorial indescribable accursed furtive. Dank unnamable cyclopean tenebrous stench immemorial. Eldritch abnormal gibbering tenebrous. Singular accursed lurk.", "Charnel antediluvian unnamable cat blasphemous comprehension tenebrous. Nameless accursed amorphous unnamable stench. Squamous unnamable mortal accursed manuscript spectral gambrel amorphous. Shunned stygian charnel unutterable. Tenebrous ululate lurk amorphous unnamable."] | ||
Faker::Books::Lovecraft.paragraphs(2) #=> ["Hideous amorphous manuscript antediluvian non-euclidean cat eldritch foetid. Stench squamous manuscript amorphous gibbering fainted gibbous. Accursed loathsome blasphemous iridescence antediluvian abnormal ululate manuscript. Singular manuscript gibbering decadent accursed indescribable.", "Tenebrous unnamable comprehension antediluvian lurk. Lurk spectral noisome gibbering. Furtive manuscript madness tenebrous daemoniac."] | ||
|
||
# Optional arguments: chars=3, supplemental=false | ||
Faker::Books::Lovecraft.paragraph_by_chars #=> "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." | ||
Faker::Books::Lovecraft.paragraph_by_chars(256) #=> "Hella kogi blog narwhal sartorial selfies mustache schlitz. Bespoke normcore kitsch cred hella fixie. Park aesthetic fixie migas twee. Cliche mustache brunch tumblr fixie godard. Drinking pop-up synth hoodie dreamcatcher typewriter. Kitsch biodiesel green." | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# frozen_string_literal: true | ||
|
||
module Faker | ||
class Books | ||
class Dune < Base | ||
class << self | ||
# QUOTED_CHARACTERS = fetch("dune.quotes") | ||
# SAYING_SOURCES = %w(translate("faker.dune.sources")) | ||
|
||
def character | ||
fetch('dune.characters') | ||
end | ||
|
||
def title | ||
fetch('dune.titles') | ||
end | ||
|
||
def planet | ||
fetch('dune.planets') | ||
end | ||
|
||
def quote(character = nil) | ||
quoted_characters = translate('faker.dune.quotes').keys | ||
|
||
if character.nil? | ||
character = sample(quoted_characters).to_s | ||
else | ||
character = character.to_s.downcase | ||
|
||
unless quoted_characters.include?(character.to_sym) | ||
raise ArgumentError, | ||
"Characters quoted can be left blank or #{quoted_characters.join(', ')}" | ||
end | ||
end | ||
|
||
fetch('dune.quotes.' + character) | ||
end | ||
|
||
def saying(source = nil) | ||
sourced_sayings = translate('faker.dune.sayings').keys | ||
|
||
if source.nil? | ||
source = sample(sourced_sayings).to_s | ||
else | ||
source = source.to_s.downcase | ||
|
||
unless sourced_sayings.include?(source.to_sym) | ||
raise ArgumentError, | ||
"Sources quoted in sayings can be left blank or #{sourced_sayings.join(', ')}" | ||
end | ||
end | ||
|
||
fetch('dune.sayings.' + source) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# frozen_string_literal: true | ||
|
||
module Faker | ||
class Books | ||
class Lovecraft < Base | ||
class << self | ||
def location | ||
fetch('lovecraft.location') | ||
end | ||
|
||
def fhtagn(number_of = 1) | ||
Array.new(number_of) { fetch('lovecraft.fhtagn') }.join('. ') | ||
end | ||
|
||
def deity | ||
fetch('lovecraft.deity') | ||
end | ||
|
||
def tome | ||
fetch('lovecraft.tome') | ||
end | ||
|
||
def sentence(word_count = 4, random_words_to_add = 6) | ||
words(word_count + rand(random_words_to_add.to_i).to_i, true).join(' ').capitalize + '.' | ||
end | ||
|
||
def word | ||
random_word = sample(translate('faker.lovecraft.words')) | ||
random_word =~ /\s/ ? word : random_word | ||
end | ||
|
||
def words(num = 3, spaces_allowed = false) | ||
resolved_num = resolve(num) | ||
word_list = translate('faker.lovecraft.words') | ||
word_list *= ((resolved_num / word_list.length) + 1) | ||
|
||
return shuffle(word_list)[0, resolved_num] if spaces_allowed | ||
|
||
words = shuffle(word_list)[0, resolved_num] | ||
words.each_with_index { |w, i| words[i] = word if w =~ /\s/ } | ||
end | ||
|
||
def sentences(sentence_count = 3) | ||
[].tap do |sentences| | ||
1.upto(resolve(sentence_count)) do | ||
sentences << sentence(3) | ||
end | ||
end | ||
end | ||
|
||
def paragraph(sentence_count = 3, random_sentences_to_add = 3) | ||
sentences(resolve(sentence_count) + rand(random_sentences_to_add.to_i).to_i).join(' ') | ||
end | ||
|
||
def paragraphs(paragraph_count = 3) | ||
[].tap do |paragraphs| | ||
1.upto(resolve(paragraph_count)) do | ||
paragraphs << paragraph(3) | ||
end | ||
end | ||
end | ||
|
||
def paragraph_by_chars(chars = 256) | ||
paragraph = paragraph(3) | ||
|
||
paragraph += ' ' + paragraph(3) while paragraph.length < chars | ||
|
||
paragraph[0...chars - 1] + '.' | ||
end | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document that argument there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?