From 648bfd5e668fed03f29d3f8b74d1749075ea8cae Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Mon, 5 Aug 2013 09:18:37 +0200 Subject: [PATCH] Use less literals to implement Mutant::Context::Scope#match_prefixes --- config/flay.yml | 2 +- lib/mutant/context/scope.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/flay.yml b/config/flay.yml index 8a0db8ff..905dcb53 100644 --- a/config/flay.yml +++ b/config/flay.yml @@ -1,3 +1,3 @@ --- threshold: 16 -total_score: 738 +total_score: 733 diff --git a/lib/mutant/context/scope.rb b/lib/mutant/context/scope.rb index 1a29db16..26ac5b3e 100644 --- a/lib/mutant/context/scope.rb +++ b/lib/mutant/context/scope.rb @@ -96,8 +96,8 @@ module Mutant # @api private # def match_prefixes - name_nesting.length.downto(1).map do |last| - name_nesting[0...last].join('::') + name_nesting.each_index.reverse_each.map do |index| + name_nesting.take(index.succ).join('::') end end memoize :match_prefixes