class Util
Public Class Methods
makeAbsolute(file, pwd)
click to toggle source
# File lib/Util.rb, line 9 def self.makeAbsolute(file, pwd) if File.isAbsolute?(file) outputfilename = file else #outputfilename = File.dirname(pwd) + "/" + file outputfilename = File.expand_path(file) end return outputfilename end
strToArray(key, map)
click to toggle source
# File lib/Util.rb, line 19 def self.strToArray(key, map) map[key][1..-2].split(",").map {|elem| elem.strip} end
truncateStr(refStr, toTruncStr)
click to toggle source
# File lib/Util.rb, line 23 def self.truncateStr(refStr, toTruncStr) posOfSlash = refStr.index("/") while posOfSlash != nil && toTruncStr[0..1] != ".." if refStr[0..posOfSlash] == toTruncStr[0..posOfSlash] toTruncStr = toTruncStr[posOfSlash+1..-1] refStr = refStr[posOfSlash+1..-1] else break end posOfSlash = refStr.index("/") end return toTruncStr end