public
Created

  • Download Gist
loremipsum.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/usr/bin/env ruby -wKU
 
text_source = ARGV[0] || 'ipsum'
 
filename = File.join(File.dirname(__FILE__), text_source + '.txt')
 
copy_to_use = File.read(filename)
 
if text_source == 'ipsum'
chopped_copy = copy_to_use.scan(/.*?[.!?](?:\s|$)/)
else
chopped_copy = copy_to_use.split(/\n\n/)
end
 
print chopped_copy[rand(chopped_copy.length)]

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.