Class: PathPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/PathPolicy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rootPath, path) ⇒ PathPolicy

Returns a new instance of PathPolicy.



5
6
7
8
# File 'lib/PathPolicy.rb', line 5

def initialize(rootPath, path)
    @rootPath = rootPath
    @path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/PathPolicy.rb', line 4

def path
  @path
end

#rootPathObject

Returns the value of attribute rootPath.



4
5
6
# File 'lib/PathPolicy.rb', line 4

def rootPath
  @rootPath
end

Instance Method Details

#getAbsolutePath(lastPath) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/PathPolicy.rb', line 24

def getAbsolutePath(lastPath)
    result = rootPath        

    if !lastPath.nil?
        if result != ""
            result += "/"
        end
        result += "#{lastPath}"
    end

    result
end

#getRelativePath(lastPath) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/PathPolicy.rb', line 10

def getRelativePath(lastPath)
    result = path

    if result != ""
        result += "/"
    end

    if !lastPath.nil?
        result += lastPath
    end

    result
end