Skip to content
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

Update docs for Lorem #1354

Merged
merged 1 commit into from
Sep 3, 2018
Merged

Update docs for Lorem #1354

merged 1 commit into from
Sep 3, 2018

Conversation

softwaregravy
Copy link
Contributor

Documented observed behavior

Link to code: https://github.com/stympy/faker/blob/master/lib/faker/lorem.rb

irb(main):023:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 0
irb(main):024:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3, true); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 0
irb(main):025:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3, false); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 0
irb(main):026:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3, true, 4); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 773
irb(main):027:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3, false, 4); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 746
irb(main):028:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence; a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 1000
irb(main):029:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence; a}.keep_if{|s| s.split(" ").count > 4 }.size
=> 0
irb(main):030:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence; a}.keep_if{|s| s.split(" ").count < 4 }.size
=> 0

Documented observed behavior

Link to code: https://github.com/stympy/faker/blob/master/lib/faker/lorem.rb

```
irb(main):023:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 0
irb(main):024:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3, true); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 0
irb(main):025:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3, false); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 0
irb(main):026:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3, true, 4); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 773
irb(main):027:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3, false, 4); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 746
irb(main):028:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence; a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 1000
irb(main):029:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence; a}.keep_if{|s| s.split(" ").count > 4 }.size
=> 0
irb(main):030:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence; a}.keep_if{|s| s.split(" ").count < 4 }.size
=> 0
```
# The 'random_words_to_add' argument increases the sentence's word count by a random value within (0..random_words_to_add).
# To specify an exact word count for a sentence, set word_count to the number you want and random_words_to_add equal to 0.
# By default, sentences will have a random number of words within the range (4..10).
Faker::Lorem.sentence #=> "Dolore illum animi et neque accusantium."
Faker::Lorem.sentence(3) #=> "Commodi qui minus deserunt sed vero quia."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆

Faker::Lorem.sentence #=> "Dolore illum animi et neque accusantium."
Faker::Lorem.sentence(3) #=> "Commodi qui minus deserunt sed vero quia."
Faker::Lorem.sentence(3, true) #=> "Inflammatio denego necessitatibus caelestis autus illum."
# By default, sentences will not have any random words added (and will all be exactly 4 words long)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@vbrazo
Copy link
Member

vbrazo commented Sep 3, 2018

Thanks for fixing these issues.

@vbrazo vbrazo merged commit c3aa4cc into faker-ruby:master Sep 3, 2018
@softwaregravy
Copy link
Contributor Author

Oh no, thank you and others for maintaining the gem. Happy to help however I can.

davidmorton0 pushed a commit to davidmorton0/faker that referenced this pull request Jul 12, 2021
Documented observed behavior

Link to code: https://github.com/stympy/faker/blob/master/lib/faker/lorem.rb

```
irb(main):023:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 0
irb(main):024:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3, true); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 0
irb(main):025:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3, false); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 0
irb(main):026:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3, true, 4); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 773
irb(main):027:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence(3, false, 4); a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 746
irb(main):028:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence; a}.keep_if{|s| s.split(" ").count > 3 }.size
=> 1000
irb(main):029:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence; a}.keep_if{|s| s.split(" ").count > 4 }.size
=> 0
irb(main):030:0> 1000.times.inject([]) {|a| a << Faker::Lorem.sentence; a}.keep_if{|s| s.split(" ").count < 4 }.size
=> 0
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants