Sha256: a476acb209d52e4e12c783990361910a3ee04d5ff4ea3e549dbe4fc97f0787a7
Contents?: true
Size: 860 Bytes
Versions: 2
Compression:
Stored size: 860 Bytes
Contents
require 'open-uri' require 'nokogiri' require 'clipboard' module UrbanPass class Generate def generate_word # Generate word: urban = random_word # Remove the extra spaces remove_spaces(urban) end def generate_phrase arr = [] 4.times do word = random_word arr << remove_spaces(word) end pass_phrase = arr.join copy(pass_phrase) return pass_phrase end def random_word page = Nokogiri::HTML(open("http://urbandictionary.com/random.php")) page.css('a.word')[0].text end def remove_spaces(phrase) phrase.gsub(" ", "") end def phrase_length(phrase) return phrase.length end def copy(phrase) word = Clipboard.copy(phrase) if Clipboard.paste == phrase return word end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
urban_pass-0.0.4.1 | lib/urban_pass/generate.rb |
urban_pass-0.0.4 | lib/urban_pass/generate.rb |