Class: Longleaf::PhysicalPathProvider
- Inherits:
-
Object
- Object
- Longleaf::PhysicalPathProvider
- Defined in:
- lib/longleaf/candidates/physical_path_provider.rb
Overview
Provides physical paths for logical paths from a mapping
Instance Method Summary collapse
-
#get_physical_path(logical_path) ⇒ Object
Physical path of the file.
-
#initialize(phys_mapping = Hash.new) ⇒ PhysicalPathProvider
constructor
A new instance of PhysicalPathProvider.
Constructor Details
#initialize(phys_mapping = Hash.new) ⇒ PhysicalPathProvider
Returns a new instance of PhysicalPathProvider.
5 6 7 |
# File 'lib/longleaf/candidates/physical_path_provider.rb', line 5 def initialize(phys_mapping = Hash.new) @phys_mapping = phys_mapping end |
Instance Method Details
#get_physical_path(logical_path) ⇒ Object
Returns physical path of the file.
11 12 13 14 15 |
# File 'lib/longleaf/candidates/physical_path_provider.rb', line 11 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 |