Sha256: c7ce218f8d85735ccca3ff119127c9a1832b0add31e56b27174c6ea1a2a4ff2c

Contents?: true

Size: 998 Bytes

Versions: 1

Compression:

Stored size: 998 Bytes

Contents

require "cicero/version"
require "cicero/cicero_text"

module Cicero
  
  @locale = 'LA'

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

  def self.locale
    @locale
  end
  
  def self.full_text
    text = full
  end

  def self.word
    words
  end

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

  def self.sentence
    sentences
  end

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

  def self.paragraph
    self.paragraphs
  end

  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


  private
  def self.full
    CiceroText.text(@locale)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cicero-0.0.1 lib/cicero.rb