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



18
19
20
21
22
23
24
# File 'lib/PathPolicy.rb', line 18

def getAbsolutePath(lastPath)
    if lastPath.nil?
        "#{rootPath}/#{path}"
    else
        "#{rootPath}/#{path}/#{lastPath}"
    end
end

#getRelativePath(lastPath) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/PathPolicy.rb', line 10

def getRelativePath(lastPath)
    if lastPath.nil?
        "#{path}"
    else
        "#{path}/#{lastPath}"
    end
end