class Delfos::FileSystem::DistanceCalculation::TraversalPathCalculator
Attributes
path_a[R]
path_b[R]
Public Class Methods
new(path_a, path_b)
click to toggle source
# File lib/delfos/file_system/distance_calculation.rb, line 52 def initialize(path_a, path_b) @path_a = path_a @path_b = path_b end
Public Instance Methods
full(start, traversal)
click to toggle source
# File lib/delfos/file_system/distance_calculation.rb, line 82 def full(start, traversal) start.realpath + Pathname.new(traversal) end
path()
click to toggle source
# File lib/delfos/file_system/distance_calculation.rb, line 57 def path return [path_a, path_b] if same_directory? current_path = path_a traversal.descend do |p| current_path = full(path_a, p) result.process(current_path) end result end
result()
click to toggle source
# File lib/delfos/file_system/distance_calculation.rb, line 74 def result @result ||= Result.new([path_a]) end
same_directory?()
click to toggle source
# File lib/delfos/file_system/distance_calculation.rb, line 70 def same_directory? path_a.dirname == path_b.dirname end
traversal()
click to toggle source
# File lib/delfos/file_system/distance_calculation.rb, line 78 def traversal path_b.relative_path_from(path_a) end