Class: Chitin::FileObject
Instance Attribute Summary
Attributes inherited from FSObject
#path
Instance Method Summary
collapse
Methods inherited from FSObject
#initialize, #lstat, #to_s, #unknown_type?
Instance Method Details
46
47
48
|
# File 'lib/chitin/file.rb', line 46
def delete
File.safe_unlink @path
end
|
#executable?(force = false) ⇒ Boolean
50
51
52
|
# File 'lib/chitin/file.rb', line 50
def executable?(force=false)
@executable = force ? File.executable?(path) : @executable
end
|
#exists? ⇒ Boolean
36
37
38
|
# File 'lib/chitin/file.rb', line 36
def exists?
File.exists? path
end
|
54
55
56
|
# File 'lib/chitin/file.rb', line 54
def inspect
"#<Chitin::FileObject #{path.inspect}>"
end
|
#open(permissions, &block) ⇒ Object
40
41
42
43
44
|
# File 'lib/chitin/file.rb', line 40
def open(permissions, &block)
File.open path, permissions do |f|
block.call f
end
end
|
#readable?(force = false) ⇒ Boolean
28
29
30
|
# File 'lib/chitin/file.rb', line 28
def readable?(force=false)
@readable = force ? File.readable(path) : @readable
end
|
#symlink? ⇒ Boolean
58
59
60
|
# File 'lib/chitin/file.rb', line 58
def symlink?
false
end
|
#writeable?(force = false) ⇒ Boolean
32
33
34
|
# File 'lib/chitin/file.rb', line 32
def writeable?(force=false)
@writeable = force ? File.writeable?(path) : @writeable
end
|