Sha256: 9b86a50957a587418440aeba85bede57755e8e914ee4c7a1f8229243c1ee0f4a

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 Bytes

Contents

module Longleaf
  # Provides physical paths for logical paths from a mapping
  class PhysicalPathProvider
    # @param phys_mapping hash with logical paths as keys, physical paths as values
    def initialize(phys_mapping = Hash.new)
      @phys_mapping = phys_mapping
    end

    # @param logical_path [String] logical path of file
    # @return physical path of the file
    def get_physical_path(logical_path)
      # return the logical path itself if no physical path is mapped
      return logical_path unless @phys_mapping.key?(logical_path)
      @phys_mapping[logical_path]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
longleaf-1.1.1 lib/longleaf/candidates/physical_path_provider.rb
longleaf-1.1.0 lib/longleaf/candidates/physical_path_provider.rb