Permalink
Browse files

Extracted format_output method

  • Loading branch information...
1 parent 9d3c0db commit d6d1d9d88f94809e1d0341cb6fb2667fc01bdefd @kerryb committed Jul 15, 2009
Showing with 5 additions and 1 deletion.
  1. +5 −1 1.rb
View
6 1.rb
@@ -12,7 +12,7 @@ def phrases(number)
break if all_strings.length >= number
all_strings += extract_phrases(words, phrase_length)
end
- all_strings[0, number].map {|s| "'#{s}'"}.join(', ')
+ format_output(all_strings[0, number])
end
private
@@ -22,6 +22,10 @@ def extract_phrases(words, phrase_length)
words[i, phrase_length].join(' ')
end
end
+
+ def format_output(phrases)
+ phrases.map {|s| "'#{s}'"}.join(', ')
+ end
end
String.send(:include, StringExtensions)

0 comments on commit d6d1d9d

Please sign in to comment.