Sha256: ff979e8a486b1c397cf1758c737da6b408e89b06f7ce2eb3967939c66a8bf75f

Contents?: true

Size: 527 Bytes

Versions: 3

Compression:

Stored size: 527 Bytes

Contents

class EngineAssets::PublicLocator
  class << self
    attr_reader :paths

    def register(full_path)
      @paths ||= []

      public_path = File.join(full_path, 'public')
      File.open(public_path) {}

      paths << public_path
    end

    def locate(file_path)
      full_paths = paths.map { |base_path| File.join(base_path, file_path) }
      full_paths.each do |full_path|
        return full_path if File.exist?(full_path)
      end
      nil
    end


    private

    def clear
      @paths = []
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
engine-assets-0.4.2 lib/engine_assets/public_locator.rb
engine-assets-0.4.1 lib/engine_assets/public_locator.rb
engine-assets-0.4.0 lib/engine_assets/public_locator.rb