Class: Util
- Inherits:
-
Object
- Object
- Util
- Defined in:
- lib/Util.rb
Class Method Summary collapse
- .makeAbsolute(file, configFile) ⇒ Object
- .strToArray(key, map) ⇒ Object
- .truncateStr(refStr, toTruncStr) ⇒ Object
Class Method Details
.makeAbsolute(file, configFile) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/Util.rb', line 9 def self.makeAbsolute(file, configFile) if File.isAbsolute?(file) outputfilename = file else outputfilename = File.dirname(configFile) + "/" + file end end |
.strToArray(key, map) ⇒ Object
17 18 19 |
# File 'lib/Util.rb', line 17 def self.strToArray(key, map) map[key][1..-2].split(",").map {|elem| elem.strip} end |
.truncateStr(refStr, toTruncStr) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/Util.rb', line 21 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 |