Module: Cicero

Defined in:
lib/cicero.rb,
lib/cicero/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.full_textObject



16
17
18
# File 'lib/cicero.rb', line 16

def self.full_text
  text = full
end

.localeObject



12
13
14
# File 'lib/cicero.rb', line 12

def self.locale
  @locale
end

.locale=(locale) ⇒ Object



8
9
10
# File 'lib/cicero.rb', line 8

def self.locale=(locale)
  @locale = locale
end

.paragraphObject



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

def self.paragraph
  self.paragraphs
end

.paragraphs(number = 1) ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/cicero.rb', line 46

def self.paragraphs(number = 1)
  text = full
  str= ""
  number.times do 
    7.times { str += "#{text.split('. ')[rand(text.split('. ').size) - 1].strip}. "}
    str.strip!
    str += "\n"
  end
  str
end

.sentenceObject



31
32
33
# File 'lib/cicero.rb', line 31

def self.sentence
  sentences
end

.sentences(number = 1) ⇒ Object



35
36
37
38
39
40
# File 'lib/cicero.rb', line 35

def self.sentences(number = 1)
  text = full
  str = ""
  number.times { str += "#{text.split('. ')[rand(text.split('. ').size) - 1].strip}. "}
  str.strip
end

.wordObject



20
21
22
# File 'lib/cicero.rb', line 20

def self.word
  words
end

.words(number = 1) ⇒ Object



24
25
26
27
28
29
# File 'lib/cicero.rb', line 24

def self.words(number = 1)
  text = full
  str = ""
  number.times{ str += "#{text.split(' ')[rand(text.split(' ').size) - 1]} "}
  str.strip.gsub(/[,.;'"!?]/,'')
end