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.



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

#pathObject

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

Returns:

  • (Boolean)


14
15
16
# File 'lib/git/path.rb', line 14

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

#to_sObject



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

def to_s
  @path
end

#writable?Boolean

Returns:

  • (Boolean)


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

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