Class: Randamu::Text

Inherits:
Base
  • Object
show all
Defined in:
lib/randamu/core/text.rb

Class Method Summary collapse

Methods inherited from Base

load_data

Class Method Details

.paragraph(phrases: 8) ⇒ Object



25
26
27
# File 'lib/randamu/core/text.rb', line 25

def paragraph(phrases: 8)
  phrases.times.map { phrase }.join(' ')
end

.phrase(words: 4) ⇒ Object



21
22
23
# File 'lib/randamu/core/text.rb', line 21

def phrase(words: 4)
  words.times.map { word }.join(' ').capitalize + '.'
end

.text(paragraphs: 4) ⇒ Object



29
30
31
# File 'lib/randamu/core/text.rb', line 29

def text(paragraphs: 4)
  paragraphs.times.map { paragraph }.join("\n\n")
end

.title(words: 3) ⇒ Object



17
18
19
# File 'lib/randamu/core/text.rb', line 17

def title(words: 3)
  words.times.map { word }.join(' ').capitalize
end

.word(format: nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/randamu/core/text.rb', line 4

def word(format: nil)
  case format
  when :upcase
    load_data('texts.lorem').sample.upcase
  when :downcase
    load_data('texts.lorem').sample.downcase
  when :capitalize
    load_data('texts.lorem').sample.capitalize
  else
    load_data('texts.lorem').sample
  end
end