Sha256: 2dff80c2203e3835a25e608289185abed62b61630ae6b0e1d923cb07ec104bc6

Contents?: true

Size: 467 Bytes

Versions: 2

Compression:

Stored size: 467 Bytes

Contents

module Lookbook
  module PathUtils
    class << self
      def to_absolute(path)
        File.absolute_path(path.to_s, Rails.root)
      end

      def normalize_all(paths, allow_root: false)
        root = Rails.application.root.to_s
        paths.map do |path|
          full_path = to_absolute(path)
          if Dir.exist?(full_path)
            full_path if allow_root || full_path.to_s != root
          end
        end.compact.uniq
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lookbook-1.2.1 lib/lookbook/support/utils/path_utils.rb
lookbook-1.2.0 lib/lookbook/support/utils/path_utils.rb