Class: Pbmenv::DirectoryObject
- Inherits:
-
Object
- Object
- Pbmenv::DirectoryObject
- Defined in:
- lib/pbmenv/directory_object.rb
Defined Under Namespace
Classes: NonSymlinkError
Instance Method Summary collapse
-
#initialize(path:) ⇒ DirectoryObject
constructor
A new instance of DirectoryObject.
- #path ⇒ Object
- #readlink ⇒ String, NilClass
- #readlink! ⇒ String
Constructor Details
#initialize(path:) ⇒ DirectoryObject
Returns a new instance of DirectoryObject.
5 6 7 |
# File 'lib/pbmenv/directory_object.rb', line 5 def initialize(path: ) @path = path end |
Instance Method Details
#path ⇒ Object
9 10 11 |
# File 'lib/pbmenv/directory_object.rb', line 9 def path @path end |
#readlink ⇒ String, NilClass
20 21 22 23 24 |
# File 'lib/pbmenv/directory_object.rb', line 20 def readlink readlink! rescue NonSymlinkError nil end |
#readlink! ⇒ String
14 15 16 17 |
# File 'lib/pbmenv/directory_object.rb', line 14 def readlink! raise NonSymlinkError if not symlink? File.readlink(path) end |