module TubularFaker
Constants
- ADDRESSES
OPTIONS
- COMPANIES
- GENERAL
- INTERNET
- LINGO
- NAMES
Public Class Methods
city()
click to toggle source
# File lib/tubular-faker.rb, line 45 def self.city "#{ADDRESSES[:city_prefix].sample} #{GENERAL[:adjectives].sample}#{ADDRESSES[:city_suffix].sample}" end
company()
click to toggle source
# File lib/tubular-faker.rb, line 41 def self.company "#{GENERAL[:adjectives].sample} #{COMPANIES[:products].sample}" end
date()
click to toggle source
# File lib/tubular-faker.rb, line 57 def self.date "#{rand(12)+1}/#{rand(29)+1}/#{GENERAL[:years].sample}" end
email()
click to toggle source
# File lib/tubular-faker.rb, line 49 def self.email "#{NAMES[:first_names].sample.downcase.gsub(/[eio\s]/, {'e' => '3', 'i' => '1', 'o' => '0', ' ' => '_'})}#{GENERAL[:numbers].sample}@#{INTERNET[:domains].sample}#{INTERNET[:dot].sample}" end
lingo()
click to toggle source
# File lib/tubular-faker.rb, line 61 def self.lingo "#{LINGO[:catchphrases].sample}" end
lorem(opts = {})
click to toggle source
returns a paragraph of lorem ipsum or multiple paragraphs if you pass in { paragraphs: 3 } to the options hash
# File lib/tubular-faker.rb, line 67 def self.lorem(opts = {}) text_blob = "" paragraphs = opts[:paragraphs] || 1 1.upto(paragraphs) do 4.times do text_blob << lorem_sentence + " " text_blob << LINGO[:catchphrases].sample + ' ' end text_blob << "\n\n" end text_blob.strip end
lorem_sentence()
click to toggle source
returns one lorem ipsum sentence
# File lib/tubular-faker.rb, line 83 def self.lorem_sentence sentence = "" sentence << ( GENERAL[:adjectives].sample + " " ).capitalize 6.times { sentence << COMPANIES[:products].sample.downcase + " " } sentence << COMPANIES[:products].sample.downcase + "." end
name()
click to toggle source
METHODS
# File lib/tubular-faker.rb, line 37 def self.name "#{NAMES[:first_names].sample} #{NAMES[:last_names].sample}" end
url()
click to toggle source
# File lib/tubular-faker.rb, line 53 def self.url "http://www.#{INTERNET[:domains].sample}#{INTERNET[:dot].sample}/#{NAMES[:first_names].sample.downcase.strip}#{GENERAL[:numbers].sample}/#{INTERNET[:pages].sample}.html" end