Skip to content

Commit

Permalink
Extracted format_output method
Browse files Browse the repository at this point in the history
  • Loading branch information
kerryb committed Jul 15, 2009
1 parent 9d3c0db commit d6d1d9d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion 1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit d6d1d9d

Please sign in to comment.