From 7f1285a77396204e882c44b993002c7c077718d8 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Mon, 18 Nov 2013 22:22:18 -0800 Subject: [PATCH] Move to flat_map now that we don't use 1.8 --- middleman-core/lib/middleman-core/util.rb | 5 ++--- middleman-core/spec/spec_helper.rb | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/middleman-core/lib/middleman-core/util.rb b/middleman-core/lib/middleman-core/util.rb index b0883fdc..54d6b63f 100644 --- a/middleman-core/lib/middleman-core/util.rb +++ b/middleman-core/lib/middleman-core/util.rb @@ -139,15 +139,14 @@ module Middleman # @param paths Some paths string or Pathname # @return [Array] An array of filenames def self.all_files_under(*paths) - # when we drop 1.8, replace this with flat_map - paths.map do |p| + paths.flat_map do |p| path = Pathname(p) if path.directory? all_files_under(*path.children) elsif path.file? path end - end.flatten.compact + end.compact end # Given a source path (referenced either absolutely or relatively) diff --git a/middleman-core/spec/spec_helper.rb b/middleman-core/spec/spec_helper.rb index 7ef65140..a9d71768 100644 --- a/middleman-core/spec/spec_helper.rb +++ b/middleman-core/spec/spec_helper.rb @@ -2,4 +2,4 @@ require 'simplecov' SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/..')) require 'coveralls' -Coveralls.wear! \ No newline at end of file +Coveralls.wear!