File: path.rb

package info (click to toggle)
ruby-git 1.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,124 kB
  • sloc: ruby: 5,385; sh: 507; perl: 64; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 456 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module Git
 
 class Path
    
    attr_accessor :path
    
    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
    
    def readable?
      File.readable?(@path)
    end

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

end