module FFaker::LoremRU

Public Instance Methods

paragraph(sentence_count = 5) click to toggle source
# File lib/ffaker/lorem_ru.rb, line 31
def paragraph(sentence_count = 5)
  sentences(sentence_count + rand(0..2)).join(' ')
end
paragraphs(paragraph_count = 3) click to toggle source
# File lib/ffaker/lorem_ru.rb, line 35
def paragraphs(paragraph_count = 3)
  (1..paragraph_count).map { paragraph }
end
phrase(word_count = 7)
Alias for: sentence
phrases(sentence_count = 3)
Alias for: sentences
sentence(word_count = 7) click to toggle source
# File lib/ffaker/lorem_ru.rb, line 16
def sentence(word_count = 7)
  elements = words(word_count + rand(0..9))
  elements.insert(rand(3..(elements.count - 3)), ',') if elements.count > 10
  result = elements.join(' ').gsub(' , ', ', ')
  capitalize_russian("#{result}#{sentence_type_mark}")
end
Also aliased as: phrase
sentences(sentence_count = 3) click to toggle source
# File lib/ffaker/lorem_ru.rb, line 25
def sentences(sentence_count = 3)
  (1..sentence_count).map { sentence }
end
Also aliased as: phrases
word() click to toggle source
# File lib/ffaker/lorem_ru.rb, line 8
def word
  fetch_sample(WORDS)
end
words(num = 3) click to toggle source
# File lib/ffaker/lorem_ru.rb, line 12
def words(num = 3)
  fetch_sample(WORDS, count: num)
end

Private Instance Methods

capitalize_russian(string) click to toggle source
# File lib/ffaker/lorem_ru.rb, line 49
def capitalize_russian(string)
  if CAPITAL_CHARS.include?(string[0])
    string
  else
    CAPITAL_CHARS[CHARS.index(string[0])] + string[1..]
  end
end
sentence_type_mark() click to toggle source
# File lib/ffaker/lorem_ru.rb, line 41
def sentence_type_mark
  case rand(10)
  when 0..7 then '.'
  when 8    then '!'
  when 9    then '?'
  end
end