Advertisement
Guest User

ruby require

a guest
Nov 17th, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.69 KB | None | 0 0
  1. # wordlist.rb
  2.  
  3. code_words = {
  4.    'starmonkeys' => 'Phil and Pete, those prickly chancellors of the New Reich',
  5.    'catapult' => 'chucky go-go',
  6.    'firebomb' => 'Heat-Assisted Living',
  7.    'Nigeria' => "Ny and Jerry's Dry Cleaning (with Donuts)",
  8.    'Put the kabosh on' => 'Put the cable box on'
  9. }
  10.  
  11.  
  12. # do.rb
  13.  
  14. require "wordlist"
  15.  
  16.  # Get evil idea and swap in code words
  17.  print "Enter your new idea: "
  18.  idea = gets
  19.  code_words.each do |real, code|
  20.    idea.gsub!( real, code )
  21.  end
  22.  
  23.  # Save the jibberish to a new file
  24.  print "File encoded.  Please enter a name for this idea: "
  25.  idea_name = gets.strip
  26.  File::open( "idea-" + idea_name + ".txt", "w" ) do |f|
  27.    f << idea
  28.  end
  29.  
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement