Skip to content

Commit

Permalink
Replace positional arguments with keyword arguments (#1664)
Browse files Browse the repository at this point in the history
* Replace positional arguments with keyword arguments

* Update CHANGELOG entries

* Update docs
  • Loading branch information
vbrazo authored Jul 24, 2019
1 parent 748adef commit cfd730e
Show file tree
Hide file tree
Showing 134 changed files with 805 additions and 793 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@
### Chores
### Deprecation
### Documentation

- [PR #1653](https://github.com/stympy/faker/pull/1653) Add /faker-ruby/faker-bot to README [@vbrazo](https://github.com/vbrazo)

### Feature Request

- [PR #1664](https://github.com/stympy/faker/pull/1664) Replace positional arguments with keyword arguments [@vbrazo](https://github.com/vbrazo)

### Update/add locales

- [PR #1658](https://github.com/stympy/faker/pull/1658) Update Faker::Games::SuperSmashBros entries [@boardfish](https://github.com/boardfish)
- [PR #1649](https://github.com/stympy/faker/pull/1649) Remove mexicoMX [@vbrazo](https://github.com/vbrazo)

------------------------------------------------------------------------------

## [v1.9.6](https://github.com/stympy/faker/tree/1.9.6) (2019-07-05)
Expand Down
4 changes: 2 additions & 2 deletions doc/books/dune.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ 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.quote(character: "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."
Faker::Books::Dune.saying(source: "fremen") #=> "May thy knife chip and shatter."
```
20 changes: 10 additions & 10 deletions doc/books/lovecraft.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

```ruby
Faker::Books::Lovecraft.fhtagn #=> "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn"
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.fhtagn(number_of: 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"

Expand All @@ -14,28 +14,28 @@ 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."
Faker::Books::Lovecraft.sentence(word_count: 3) #=> "Daemoniac antediluvian fainted squamous comprehension gambrel nameless singular."
Faker::Books::Lovecraft.sentence(word_count: 3, random_words_to_add: 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"]
Faker::Books::Lovecraft.words(num: 2) #=> ["daemoniac", "cat"]
Faker::Books::Lovecraft.words(num: 2, spaces_allowed: 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."]
Faker::Books::Lovecraft.sentences(sentence_count: 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."
Faker::Books::Lovecraft.paragraph(sentence_count: 2) #=> "Decadent lurk tenebrous loathsome furtive spectral amorphous gibbous. Gambrel eldritch daemoniac cat madness comprehension stygian effulgence."
Faker::Books::Lovecraft.paragraph(sentence_count: 2, random_sentences_to_add: 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."]
Faker::Books::Lovecraft.paragraphs(paragraph_count: 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."
Faker::Books::Lovecraft.paragraph_by_chars(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."
```
4 changes: 2 additions & 2 deletions doc/default/alphanumeric.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
It might be available in the next version.

```ruby
Faker::Alphanumeric.alpha 10 #=> "zlvubkrwga"
Faker::Alphanumeric.alpha(char_count: 10) #=> "zlvubkrwga"

Faker::Alphanumeric.alphanumeric 10 #=> "3yfq2phxtb"
Faker::Alphanumeric.alphanumeric(char_count: 10) #=> "3yfq2phxtb"
```
10 changes: 5 additions & 5 deletions doc/default/avatar.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
```ruby
Faker::Avatar.image #=> "https://robohash.org/sitsequiquia.png?size=300x300&set=set1"

Faker::Avatar.image("my-own-slug") #=> "https://robohash.org/my-own-slug.png?size=300x300&set=set1"
Faker::Avatar.image(slug: "my-own-slug") #=> "https://robohash.org/my-own-slug.png?size=300x300&set=set1"

Faker::Avatar.image("my-own-slug", "50x50") #=> "https://robohash.org/my-own-slug.png?size=50x50&set=set1"
Faker::Avatar.image(slug: "my-own-slug", size: "50x50") #=> "https://robohash.org/my-own-slug.png?size=50x50&set=set1"

Faker::Avatar.image("my-own-slug", "50x50", "jpg") #=> "https://robohash.org/my-own-slug.jpg?size=50x50&set=set1"
Faker::Avatar.image(slug: "my-own-slug", size: "50x50", format: "jpg") #=> "https://robohash.org/my-own-slug.jpg?size=50x50&set=set1"

Faker::Avatar.image("my-own-slug", "50x50", "bmp") #=> "https://robohash.org/my-own-slug.bmp?size=50x50&set=set1"
Faker::Avatar.image(slug: "my-own-slug", size: "50x50", format: "bmp") #=> "https://robohash.org/my-own-slug.bmp?size=50x50&set=set1"

Faker::Avatar.image("my-own-slug", "50x50", "bmp", "set1", "bg1") #=> "https://robohash.org/my-own-slug.bmp?size=50x50&set=set1&bgset=bg1"
Faker::Avatar.image(slug: "my-own-slug", size: "50x50", format: "bmp", set: "set1", bgset: "bg1") #=> "https://robohash.org/my-own-slug.bmp?size=50x50&set=set1&bgset=bg1"
```
6 changes: 2 additions & 4 deletions doc/default/bank.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@

Faker::Bank.account_number #=> 6738582379

Faker::Bank.account_number(13) #=> 673858237902
Faker::Bank.account_number(digits: 13) #=> 673858237902

Faker::Bank.iban #=> "GB76DZJM33188515981979"

# Optional argument bank_country_code
# All countries should be supported
Faker::Bank.iban("be") #=> "BE6375388567752043"
Faker::Bank.iban(country_code: "be") #=> "BE6375388567752043"

Faker::Bank.name #=> "ABN AMRO CORPORATE FINANCE LIMITED"

Faker::Bank.routing_number #=> "729343831"

Faker::Bank.routing_number(true) #=> "22-3833/64805"

Faker::Bank.swift_bic #=> "AAFMGB21"
```
2 changes: 1 addition & 1 deletion doc/default/boolean.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ Available since version 1.6.2.
# Optional parameter: true_ratio=0.5
Faker::Boolean.boolean #=> true

Faker::Boolean.boolean(0.2) #=> false
Faker::Boolean.boolean(true_ratio: 0.2) #=> false
```
2 changes: 1 addition & 1 deletion doc/default/chile_rut.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Faker::ChileRut.full_rut #=> "30686957-4"
Faker::ChileRut.rut #=> 11235813

# Returns rut between passed minimum rut and 99999999
Faker::ChileRut.rut(20_890_156) #=> 31853211
Faker::ChileRut.rut(min_rut: 20_890_156) #=> 31853211

# Every call to rut or full_rut generates a new random rut, so last_rut and dv
# allows you to get the separated parts of the full rut without losing the already generated rut
Expand Down
2 changes: 1 addition & 1 deletion doc/default/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Faker::Code.rut #=> "91389184-8"

Faker::Code.nric #=> "S5589083H"

Faker::Code.nric(27, 34) #=> S8505970Z
Faker::Code.nric(min_age: 27, max_age: 34) #=> S8505970Z

Faker::Code.imei #= "546327785982623"

Expand Down
10 changes: 5 additions & 5 deletions doc/default/commerce.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ Faker::Commerce.color #=> "lavender"

# Optional arguments max=3, fixed_amount=false
Faker::Commerce.department #=> "Grocery, Health & Beauty"
Faker::Commerce.department(5) #=> "Grocery, Books, Health & Beauty"
Faker::Commerce.department(2, true) #=> "Books & Tools"
Faker::Commerce.department(max: 5) #=> "Grocery, Books, Health & Beauty"
Faker::Commerce.department(max: 2, fixed_amount: true) #=> "Books & Tools"

Faker::Commerce.material #=> "Steel"

Faker::Commerce.product_name #=> "Practical Granite Shirt"

# Produces a Float by default
Faker::Commerce.price #=> 44.6
Faker::Commerce.price(range = 0..10.0, as_string = true) #=> "2.18"
Faker::Commerce.price #=> 44.6
Faker::Commerce.price(range: 0..10.0, as_string: true) #=> "2.18"

# Generate a random promotion code.
# Optional argument digits = 6 for number of random digits in suffix
Faker::Commerce.promotion_code #=> "AmazingDeal829102"
Faker::Commerce.promotion_code(digits = 2) #=> "AmazingPrice57"
Faker::Commerce.promotion_code(digits: 2) #=> "AmazingPrice57"

Faker::Commerce.material #=> "Plastic"
```
6 changes: 3 additions & 3 deletions doc/default/date.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Faker::Date.between(2.days.ago, Date.today) #=> "Wed, 24 Sep 2014"
Faker::Date.between_except(1.year.ago, 1.year.from_now, Date.today) #=> "Wed, 24 Sep 2014"

# Random date in the future (up to maximum of N days)
Faker::Date.forward(23) # => "Fri, 03 Oct 2014"
Faker::Date.forward(days: 23) # => "Fri, 03 Oct 2014"

# Random date in the past (up to maximum of N days)
Faker::Date.backward(14) #=> "Fri, 19 Sep 2014"
Faker::Date.backward(days: 14) #=> "Fri, 19 Sep 2014"

# Random birthday date (maximum age between 18 and 65)
Faker::Date.birthday(18, 65) #=> "Mar, 28 Mar 1986"
Faker::Date.birthday(min_age: 18, max_age: 65) #=> "Mar, 28 Mar 1986"
```
2 changes: 1 addition & 1 deletion doc/default/demographic.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ Faker::Demographic.sex #=> "Female"

Faker::Demographic.height #=> "1.61"

Faker::Demographic.height(:imperial) #=> "6 ft, 2 in"
Faker::Demographic.height(unit: :imperial) #=> "6 ft, 2 in"
```
14 changes: 7 additions & 7 deletions doc/default/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ Faker::File.extension #=> "mp3"
Faker::File.mime_type #=> "application/pdf"

# Optional arguments: dir, name, extension, directory_separator
Faker::File.file_name('path/to') #=> "path/to/something_random.jpg"
Faker::File.file_name('foo/bar', 'baz') #=> "foo/bar/baz.zip"
Faker::File.file_name('foo/bar', 'baz', 'doc') #=> "foo/bar/baz.doc"
Faker::File.file_name('foo/bar', 'baz', 'mp3', '\\') #=> "foo\bar\baz.mp3"
Faker::File.file_name(dir: 'path/to') #=> "path/to/something_random.jpg"
Faker::File.file_name(dir: 'foo/bar', name: 'baz') #=> "foo/bar/baz.zip"
Faker::File.file_name(dir: 'foo/bar', name: 'baz', ext: 'doc') #=> "foo/bar/baz.doc"
Faker::File.file_name(dir: 'foo/bar', name: 'baz', ext: 'mp3', directory_separator: '\\') #=> "foo\bar\baz.mp3"

# Optional arguments: segment_count, root, directory_separator
Faker::File.dir #=> "path/to/something_random"
Faker::File.dir(2) #=> "foo/bar"
Faker::File.dir(3, '/') #=> "/foo/bar/baz"
Faker::File.dir(3, nil, '\\') #=> "foo\bar\baz"
Faker::File.dir(segment_count: 2) #=> "foo/bar"
Faker::File.dir(segment_count: 3, root: directory_separator: '/') #=> "/foo/bar/baz"
Faker::File.dir(segment_count: 3, root: nil, directory_separator: '\\') #=> "foo\bar\baz"
```
4 changes: 2 additions & 2 deletions doc/default/fillmurray.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Available since version 1.7.1.
```ruby
Faker::Fillmurray.image #=> "http://www.fillmurray.com/300/300"

Faker::Fillmurray.image(true) #=> "http://www.fillmurray.com/g/300/300"
Faker::Fillmurray.image(grayscale: true) #=> "http://fillmurray.com/g/300/300"

Faker::Fillmurray.image(false, 200, 400) #=> "http://www.fillmurray.com/200/400"
Faker::Fillmurray.image(grayscale: false, width: 200, height: 400) #=> "http://fillmurray.com/200/400"
```
4 changes: 2 additions & 2 deletions doc/default/finance.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Faker::Finance.credit_card(:mastercard, :visa) #=> "4448-8934-1277-7195"

# Random vat_number
Faker::Finance.vat_number #=> "BR38.395.329/2471-83"
Faker::Finance.vat_number('DE') #=> "DE593306671"
Faker::Finance.vat_number('ZA') #=> "ZA79494416181"
Faker::Finance.vat_number(country: 'DE') #=> "DE593306671"
Faker::Finance.vat_number(country: 'ZA') #=> "ZA79494416181"
```
Loading

0 comments on commit cfd730e

Please sign in to comment.