Class: Git::Path
- Inherits:
-
Object
show all
- Defined in:
- lib/git/path.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(path, check_path = true) ⇒ Path
Returns a new instance of Path.
6
7
8
9
10
11
12
|
# File 'lib/git/path.rb', line 6
def initialize(path, check_path = true)
if !check_path || File.exists?(path)
@path = File.expand_path(path)
else
raise ArgumentError, "path does not exist", File.expand_path(path)
end
end
|
Instance Attribute Details
Returns the value of attribute path.
4
5
6
|
# File 'lib/git/path.rb', line 4
def path
@path
end
|
Instance Method Details
#readable? ⇒ Boolean
14
15
16
|
# File 'lib/git/path.rb', line 14
def readable?
File.readable?(@path)
end
|
22
23
24
|
# File 'lib/git/path.rb', line 22
def to_s
@path
end
|
#writable? ⇒ Boolean
18
19
20
|
# File 'lib/git/path.rb', line 18
def writable?
File.writable?(@path)
end
|