Permalink
Browse files

Extract regex into constant

  • Loading branch information...
1 parent 6086010 commit 801396225270bbdd84b6a0562a9d47522a3f26df @coreyhaines coreyhaines committed Mar 1, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/turbulence/calculators/complexity.rb
@@ -24,8 +24,9 @@ def score_for_file(filename)
end
class Reporter < ::StringIO
+ SCORE_LINE_DETECTOR = /^\s+([^:]+).*flog total$/
def score
- Float(string.scan(/^\s+([^:]+).*total$/).flatten.first)
+ Float(string.scan(SCORE_LINE_DETECTOR).flatten.first)
end
end
end

0 comments on commit 8013962

Please sign in to comment.