added some low level tree operations and tests
[rubygit.git] / lib / git / path.rb
blob87f5c84e910b0909d716ac9ddcb09b2df764aa13
1 module Git
2   class Path
3     
4     attr_accessor :path
5     
6     def initialize(path, check_path = true)
7       if !check_path || File.exists?(path)
8         @path = File.expand_path(path)
9       else
10         raise ArgumentError, "path does not exist", File.expand_path(path)
11       end
12     end
13     
14     def readable?
15       File.readable?(@path)
16     end
18     def writable?
19       File.writable?(@path)
20     end
21     
22     def to_s
23       @path
24     end
25     
26   end
27 end