Class: Git::Path
- Inherits:
-
Object
- Object
- Git::Path
- Defined in:
- lib/git/path.rb
Direct Known Subclasses
Branch, Index, Remote, Repository, WorkingDirectory, Worktree
Instance Attribute Summary collapse
-
#path
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path, check_path = true) ⇒ Path
constructor
A new instance of Path.
- #readable? ⇒ Boolean
- #to_s
- #writable? ⇒ Boolean
Constructor Details
#initialize(path, check_path = true) ⇒ Path
Returns a new instance of Path.
7 8 9 10 11 12 13 14 15 |
# File 'lib/git/path.rb', line 7 def initialize(path, check_path=true) path = File.(path) if check_path && !File.exist?(path) raise ArgumentError, 'path does not exist', [path] end @path = path end |
Instance Attribute Details
#path
Returns the value of attribute path.
5 6 7 |
# File 'lib/git/path.rb', line 5 def path @path end |
Instance Method Details
#readable? ⇒ Boolean
17 18 19 |
# File 'lib/git/path.rb', line 17 def readable? File.readable?(@path) end |
#to_s
25 26 27 |
# File 'lib/git/path.rb', line 25 def to_s @path end |
#writable? ⇒ Boolean
21 22 23 |
# File 'lib/git/path.rb', line 21 def writable? File.writable?(@path) end |