Class: Randamu::Text
Class Method Summary collapse
- .paragraph(phrases: 8) ⇒ Object
- .phrase(words: 4) ⇒ Object
- .text(paragraphs: 4) ⇒ Object
- .title(words: 3) ⇒ Object
- .word(format: nil) ⇒ Object
Methods inherited from Base
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 |