class Lorem::LoremObject

Public Instance Methods

date(fmt = '%a %b %d, %Y', range = 1950..2010, replacement = nil) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 67
def date(fmt = '%a %b %d, %Y', range = 1950..2010, replacement = nil)
  y = rand(range.last - range.first) + range.first
  m = rand(12) + 1
  d = rand(31) + 1
  Time.local(y,m,d).strftime(fmt)
end
email(replacement = nil) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 88
def email(replacement = nil)
  delimiters = [ '_', '-', '' ]
  domains = %w(gmail.com yahoo.com hotmail.com email.com live.com me.com mac.com aol.com fastmail.com mail.com)
  username = name.gsub(/[^\w]/, delimiters[rand(delimiters.size)])
  "#{username}@#{domains[rand(domains.size)]}".downcase
end
first_name(replacement = nil) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 78
def first_name(replacement = nil)
  names = %w(Judith Angelo Margarita Kerry Elaine Lorenzo Justice Doris Raul Liliana Kerry Elise Ciaran Johnny Moses Davion Penny Mohammed Harvey Sheryl Hudson Brendan Brooklynn Denis Sadie Trisha Jacquelyn Virgil Cindy Alexa Marianne Giselle Casey Alondra Angela Katherine Skyler Kyleigh Carly Abel Adrianna Luis Dominick Eoin Noel Ciara Roberto Skylar Brock Earl Dwayne Jackie Hamish Sienna Nolan Daren Jean Shirley Connor Geraldine Niall Kristi Monty Yvonne Tammie Zachariah Fatima Ruby Nadia Anahi Calum Peggy Alfredo Marybeth Bonnie Gordon Cara John Staci Samuel Carmen Rylee Yehudi Colm Beth Dulce Darius inley Javon Jason Perla Wayne Laila Kaleigh Maggie Don Quinn Collin Aniya Zoe Isabel Clint Leland Esmeralda Emma Madeline Byron Courtney Vanessa Terry Antoinette George Constance Preston Rolando Caleb Kenneth Lynette Carley Francesca Johnnie Jordyn Arturo Camila Skye Guy Ana Kaylin Nia Colton Bart Brendon Alvin Daryl Dirk Mya Pete Joann Uriel Alonzo Agnes Chris Alyson Paola Dora Elias Allen Jackie Eric Bonita Kelvin Emiliano Ashton Kyra Kailey Sonja Alberto Ty Summer Brayden Lori Kelly Tomas Joey Billie Katie Stephanie Danielle Alexis Jamal Kieran Lucinda Eliza Allyson Melinda Alma Piper Deana Harriet Bryce Eli Jadyn Rogelio Orlaith Janet Randal Toby Carla Lorie Caitlyn Annika Isabelle inn Ewan Maisie Michelle Grady Ida Reid Emely Tricia Beau Reese Vance Dalton Lexi Rafael Makenzie Mitzi Clinton Xena Angelina Kendrick Leslie Teddy Jerald Noelle Neil Marsha Gayle Omar Abigail Alexandra Phil Andre Billy Brenden Bianca Jared Gretchen Patrick Antonio Josephine Kyla Manuel Freya Kellie Tonia Jamie Sydney Andres Ruben Harrison Hector Clyde Wendell Kaden Ian Tracy Cathleen Shawn)
  names[rand(names.size)]
end
image(size, options={}) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 95
def image(size, options={})
  src              = "http://placehold.it/#{size}"
  hex              = %w[a b c d e f 0 1 2 3 4 5 6 7 8 9]
  background_color = options[:background_color]
  color            = options[:color]

  if options[:random_color]
    background_color = hex.shuffle[0...6].join
    color = hex.shuffle[0...6].join
  end

  src << "/#{background_color.sub(/^#/, '')}" if background_color
  src << "/ccc" if background_color.nil? && color
  src << "/#{color.sub(/^#/, '')}" if color
  src << "&text=#{Rack::Utils::escape(options[:text])}" if options[:text]

  src
end
last_name(replacement = nil) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 83
def last_name(replacement = nil)
  names = %w(Chung Chen Melton Hill Puckett Song Hamilton Bender Wagner McLaughlin McNamara Raynor Moon Woodard Desai Wallace Lawrence Griffin Dougherty Powers May Steele Teague Vick Gallagher Solomon Walsh Monroe Connolly Hawkins Middleton Goldstein Watts Johnston Weeks Wilkerson Barton Walton Hall Ross Chung Bender Woods Mangum Joseph Rosenthal Bowden Barton Underwood Jones Baker Merritt Cross Cooper Holmes Sharpe Morgan Hoyle Allen Rich Rich Grant Proctor Diaz Graham Watkins Hinton Marsh Hewitt Branch Walton O'Brien Case Watts Christensen Parks Hardin Lucas Eason Davidson Whitehead Rose Sparks Moore Pearson Rodgers Graves Scarborough Sutton Sinclair Bowman Olsen Love McLean Christian Lamb James Chandler Stout Cowan Golden Bowling Beasley Clapp Abrams Tilley Morse Boykin Sumner Cassidy Davidson Heath Blanchard McAllister McKenzie Byrne Schroeder Griffin Gross Perkins Robertson Palmer Brady Rowe Zhang Hodge Li Bowling Justice Glass Willis Hester Floyd Graves Fischer Norman Chan Hunt Byrd Lane Kaplan Heller May Jennings Hanna Locklear Holloway Jones Glover Vick O'Donnell Goldman McKenna Starr Stone McClure Watson Monroe Abbott Singer Hall Farrell Lucas Norman Atkins Monroe Robertson Sykes Reid Chandler Finch Hobbs Adkins Kinney Whitaker Alexander Conner Waters Becker Rollins Love Adkins Black Fox Hatcher Wu Lloyd Joyce Welch Matthews Chappell MacDonald Kane Butler Pickett Bowman Barton Kennedy Branch Thornton McNeill Weinstein Middleton Moss Lucas Rich Carlton Brady Schultz Nichols Harvey Stevenson Houston Dunn West O'Brien Barr Snyder Cain Heath Boswell Olsen Pittman Weiner Petersen Davis Coleman Terrell Norman Burch Weiner Parrott Henry Gray Chang McLean Eason Weeks Siegel Puckett Heath Hoyle Garrett Neal Baker Goldman Shaffer Choi Carver)
  names[rand(names.size)]
end
name(replacement = nil) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 74
def name(replacement = nil)
  "#{first_name} #{last_name}"
end
paragraph(replacement = nil) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 57
def paragraph(replacement = nil)
  paragraphs 1, replacement
end
paragraphs(total, replacement = nil) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 61
def paragraphs(total, replacement = nil)
  (1..total).map do
    sentences(randm(3..7), replacement).capitalize
  end.join("\n\n")
end
sentence(replacement = nil) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 47
def sentence(replacement = nil)
  sentences 1, replacement
end
sentences(total, replacement = nil) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 51
def sentences(total, replacement = nil)
  (1..total).map do
    words(randm(4..15)).capitalize
  end.join('. ')
end
word(replacement = nil) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 37
def word(replacement = nil)
  words 1, replacement
end
words(total, replacement = nil) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 41
def words(total, replacement = nil)
  (1..total).map do
    randm(WORDS)
  end.join(' ')
end

Private Instance Methods

randm(range) click to toggle source
# File lib/starter_web/_plugins/lorem_inline.rb, line 116
def randm(range)
  a = range.to_a
  a[rand(a.length)]
end