summaryrefslogtreecommitdiffstats
path: root/lib/git/path.rb
blob: 18845fa49d84d657a5aa3f39bcd4a950da68b3d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Git
  class Path
    
    attr_accessor :path
    
    def initialize(path, check_path = true)
      if !check_path || File.exists?(path)
        @path = path
      else
        raise ArgumentError, "path does not exist", path 
      end
    end
    
    def readable?
      File.readable?(@path)
    end

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