Class: PathPolicy
- Inherits:
-
Object
- Object
- PathPolicy
- Defined in:
- lib/PathPolicy.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#rootPath ⇒ Object
Returns the value of attribute rootPath.
Instance Method Summary collapse
- #getAbsolutePath(lastPath) ⇒ Object
- #getRelativePath(lastPath) ⇒ Object
-
#initialize(rootPath, path) ⇒ PathPolicy
constructor
A new instance of PathPolicy.
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
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/PathPolicy.rb', line 4 def path @path end |
#rootPath ⇒ Object
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 |