lib/urban_pass/generate.rb in urban_pass-0.0.1.1 vs lib/urban_pass/generate.rb in urban_pass-0.0.2

- old
+ new

@@ -7,15 +7,15 @@ def generate # Generate word: urban = random_word # Remove the extra spaces - phrase = remove_spaces(urban) + word = remove_spaces(urban) # Return the length of the phrase and print out the word - puts "Your new password is: #{phrase}" - puts "The word is #{phrase_length(phrase)} charcters long" + puts "Your word is: #{word}" + puts "The word is #{phrase_length(word)} charcters long" end def random_word page = Nokogiri::HTML(open("http://urbandictionary.com/random.php")) word = page.css('a.word')[0].text @@ -26,8 +26,18 @@ end def phrase_length(phrase) return phrase.length + end + + def generate_phrase + arr = [] + 4.times do + word = random_word + arr << remove_spaces(word) + end + pass_phrase = arr.join + return pass_phrase end end end