Class: Delfos::FileSystem::PathDetermination
- Inherits:
-
Object
- Object
- Delfos::FileSystem::PathDetermination
- Defined in:
- lib/delfos/file_system/path_determination.rb
Class Method Summary collapse
Instance Method Summary collapse
- #full_path ⇒ Object
-
#initialize(file) ⇒ PathDetermination
constructor
A new instance of PathDetermination.
Constructor Details
#initialize(file) ⇒ PathDetermination
Returns a new instance of PathDetermination.
9 10 11 |
# File 'lib/delfos/file_system/path_determination.rb', line 9 def initialize(file) @file = Pathname.new((file)) end |
Class Method Details
.for(*files) ⇒ Object
5 6 7 |
# File 'lib/delfos/file_system/path_determination.rb', line 5 def self.for(*files) files.map { |f| new(f).full_path } end |
Instance Method Details
#full_path ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/delfos/file_system/path_determination.rb', line 13 def full_path return @file.realpath if File.exist?(@file) Delfos.application_directories.map do |d| path = try_path { d + @file } path || try_path do Pathname.new(d + @file.to_s.gsub(%r{[^/]*/}, "")) end end.compact.first end |