Class: Appydave::Tools::Jump::PathValidator
- Inherits:
-
Object
- Object
- Appydave::Tools::Jump::PathValidator
- Defined in:
- lib/appydave/tools/jump/path_validator.rb
Overview
PathValidator checks if filesystem paths exist
This class is designed for dependency injection in tests. Production code uses the real filesystem, while tests inject a mock that returns predetermined results.
Instance Method Summary collapse
-
#exists?(path) ⇒ Boolean
Check if a path exists as a directory.
-
#expand(path) ⇒ String
Expand a path (resolve ~ and relative paths).
-
#file_exists?(path) ⇒ Boolean
Check if a path exists as a file.
Instance Method Details
#exists?(path) ⇒ Boolean
Check if a path exists as a directory
25 26 27 |
# File 'lib/appydave/tools/jump/path_validator.rb', line 25 def exists?(path) File.directory?((path)) end |
#expand(path) ⇒ String
Expand a path (resolve ~ and relative paths)
41 42 43 |
# File 'lib/appydave/tools/jump/path_validator.rb', line 41 def (path) File.(path) end |
#file_exists?(path) ⇒ Boolean
Check if a path exists as a file
33 34 35 |
# File 'lib/appydave/tools/jump/path_validator.rb', line 33 def file_exists?(path) File.exist?((path)) end |