Module: FFaker::LoremPL

Extended by:
LoremPL, ModuleUtils
Included in:
LoremPL
Defined in:
lib/ffaker/lorem_pl.rb

Overview

Inspirations: pl.wiktionary.org

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, luhn_check, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#characterObject



10
11
12
# File 'lib/ffaker/lorem_pl.rb', line 10

def character
  fetch_sample(CHARACTERS)
end

#characters(count = 10) ⇒ Object



14
15
16
# File 'lib/ffaker/lorem_pl.rb', line 14

def characters(count = 10)
  fetch_sample(CHARACTERS, count: count).join
end

#paragraph(count = 3) ⇒ Object



42
43
44
# File 'lib/ffaker/lorem_pl.rb', line 42

def paragraph(count = 3)
  sentences(count + rand(0..2)).join(' ')
end

#paragraphs(count = 3) ⇒ Object



46
47
48
# File 'lib/ffaker/lorem_pl.rb', line 46

def paragraphs(count = 3)
  (1..count).map { paragraph }
end

#sentence(count = 7) ⇒ Object Also known as: phrase



26
27
28
29
30
31
32
# File 'lib/ffaker/lorem_pl.rb', line 26

def sentence(count = 7)
  sentence = words(count + rand(0..5))
  sentence[rand(3..(sentence.length - 3))] += ',' if sentence.length > 10
  sentence = sentence.join(' ')
  sentence = sentence.capitalize
  "#{sentence}#{end_of_sentence}"
end

#sentences(count = 3) ⇒ Object Also known as: phrases



36
37
38
# File 'lib/ffaker/lorem_pl.rb', line 36

def sentences(count = 3)
  (1..count).map { sentence }
end

#wordObject



18
19
20
# File 'lib/ffaker/lorem_pl.rb', line 18

def word
  fetch_sample(WORDS)
end

#words(count = 3) ⇒ Object



22
23
24
# File 'lib/ffaker/lorem_pl.rb', line 22

def words(count = 3)
  fetch_sample(WORDS, count: count)
end