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.
9 10 11 12 13 14 15 16 17 |
# File 'lib/git/path.rb', line 9 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.
7 8 9 |
# File 'lib/git/path.rb', line 7 def path @path end |
Instance Method Details
#readable? ⇒ Boolean
19 20 21 |
# File 'lib/git/path.rb', line 19 def readable? File.readable?(@path) end |
#to_s
27 28 29 |
# File 'lib/git/path.rb', line 27 def to_s @path end |
#writable? ⇒ Boolean
23 24 25 |
# File 'lib/git/path.rb', line 23 def writable? File.writable?(@path) end |