class FillerText::FillerText

Public Class Methods

bytes(n=nil) click to toggle source
# File lib/fillertext/fillertext.rb, line 44
def self.bytes(n=nil)
  n ||= self.n
  self.style.text[0,n]
end
characters(n=nil) click to toggle source
# File lib/fillertext/fillertext.rb, line 49
def self.characters(n=nil)
  #same thing for now
  self.bytes(n)
end
n() click to toggle source
# File lib/fillertext/fillertext.rb, line 40
def self.n
  @@num
end
n=(n) click to toggle source
# File lib/fillertext/fillertext.rb, line 36
def self.n=(n)
  @@num = n
end
paragraphs(n=nil) click to toggle source
# File lib/fillertext/fillertext.rb, line 65
def self.paragraphs(n=nil)
  n ||= self.n
  self.style.text.split("\n").slice(0,n).join("\n")
end
sentences(n=nil) click to toggle source
# File lib/fillertext/fillertext.rb, line 60
def self.sentences(n=nil)
  n ||= self.n
  self.style.text.split('.').slice(0,n).join(". ")
end
style() click to toggle source
# File lib/fillertext/fillertext.rb, line 30
def self.style
  @@style
end
style=(style) click to toggle source
# File lib/fillertext/fillertext.rb, line 26
def self.style=(style)
  @@style = style
end
words(n=nil) click to toggle source
# File lib/fillertext/fillertext.rb, line 54
def self.words(n=nil)
  n ||= self.n
  #the idea here is to find the nth space and return everything before it
  self.style.text.split[0,n].join(" ").gsub(/[^\w\s]/,'')
end