Skip to content

Commit

Permalink
That looked like premature optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
kerryb committed Jul 15, 2009
1 parent 04b2a46 commit 727fffe
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions 1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ def double_triple_words(strings)
all_strings = []
num_words = strings.size

return all_strings unless has_enough_words(num_words)

# Extracting double-word phrases
(0...num_words - 1).each do |i|
all_strings << "#{strings[i]} #{strings[i + 1]}"
Expand All @@ -31,10 +29,6 @@ def double_triple_words(strings)
end
return all_strings
end

def has_enough_words(num_words)
num_words >= 3
end
end

String.send(:include, StringExtensions)
Expand Down

0 comments on commit 727fffe

Please sign in to comment.