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
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 |