Skip to content

Commit

Permalink
Just use inject rather than map.inject.
Browse files Browse the repository at this point in the history
  • Loading branch information
myronmarston committed Nov 23, 2012
1 parent 9c8d6bd commit 2919139
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/rspec/core/metadata.rb
Expand Up @@ -89,10 +89,11 @@ def first_caller_from_outside_rspec
self[:caller].detect {|l| l !~ /\/lib\/rspec\/core/}
end

def build_description_from(*parts)
parts.map {|p| p.to_s}.inject do |desc, p|
def build_description_from(first_part = '', *parts)
parts.inject(first_part.to_s) do |desc, p|
p = p.to_s
p =~ /^(#|::|\.)/ ? "#{desc}#{p}" : "#{desc} #{p}"
end || ""
end
end
end

Expand Down

0 comments on commit 2919139

Please sign in to comment.