class Disloku::Util::File
Attributes
change[RW]
srcPath[RW]
Public Class Methods
getSegments(path)
click to toggle source
# File lib/disloku/util/File.rb, line 12 def self.getSegments(path) return path.split(/#{SPLIT_EXP}/) end
new(filePath, basePath, target, change)
click to toggle source
# File lib/disloku/util/File.rb, line 18 def initialize(filePath, basePath, target, change) @srcPath = filePath @target = target @change = change fileSegments = File.getSegments(filePath) baseSegments = File.getSegments(basePath) index = 0 while (fileSegments[index] == baseSegments[index]) index += 1 end @relativeSrcSegments = fileSegments[index..-1] @relativeDstSegments = target.mapPath(@relativeSrcSegments) end
Public Instance Methods
getAbsoluteDstPath(basePath = nil)
click to toggle source
# File lib/disloku/util/File.rb, line 46 def getAbsoluteDstPath(basePath = nil) basePath = basePath || @target.targetDir return ::File.join(basePath, *@relativeDstSegments) end
getRelativeDirSegments()
click to toggle source
# File lib/disloku/util/File.rb, line 38 def getRelativeDirSegments() return @segments[0..-2] end
getRelativeDstSegments()
click to toggle source
# File lib/disloku/util/File.rb, line 34 def getRelativeDstSegments() return @segments end
hasMapping?()
click to toggle source
# File lib/disloku/util/File.rb, line 42 def hasMapping?() return @relativeDstSegments != nil end
to_s()
click to toggle source
# File lib/disloku/util/File.rb, line 51 def to_s() operation = (@change.changeType == :deleted ? "x>" : "->") return "#{srcPath} #{operation} #{getAbsoluteDstPath()}" end