Class: Git::Path

Inherits:
Object
  • Object
show all
Defined in:
lib/git/path.rb

Direct Known Subclasses

Branch, Index, Remote, Repository, WorkingDirectory

Instance Attribute Summary collapse

Instance Method Summary collapse

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.expand_path(path)
  
  if check_path && !File.exist?(path)
    raise ArgumentError, 'path does not exist', [path]
  end
  
  @path = path
end

Instance Attribute Details

#pathObject

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

Returns:

  • (Boolean)


17
18
19
# File 'lib/git/path.rb', line 17

def readable?
  File.readable?(@path)
end

#to_sObject



25
26
27
# File 'lib/git/path.rb', line 25

def to_s
  @path
end

#writable?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/git/path.rb', line 21

def writable?
  File.writable?(@path)
end