Skip to content

Commit

Permalink
Replace inject with slightly more legible select
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Spiers authored and Adam Spiers committed Nov 8, 2010
1 parent f46df77 commit 721d6ef
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/capybara/util/save_and_open_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ def open_in_browser(path) # :nodoc

def rewrite_css_and_image_references(response_html) # :nodoc:
return response_html unless Capybara.asset_root
directories = Dir.new(Capybara.asset_root).entries.inject([]) do |list, name|
list << name if File.directory?(name) and not name.to_s =~ /^\./
list
end
directories = Dir.new(Capybara.asset_root).entries.select { |name|
File.directory?(name) and not name.to_s =~ /^\./
}
response_html.gsub(/=("|')\/(#{directories.join('|')})/, '=\1' + Capybara.asset_root.to_s + '/\2')
end
end
Expand Down

0 comments on commit 721d6ef

Please sign in to comment.