Class: Chitin::FileObject
Instance Attribute Summary
Attributes inherited from FSObject
#path, #search
Instance Method Summary
collapse
Methods inherited from FSObject
#directory?, #each, #files, #initialize, #lstat, #size, #symlink?, #to_a, #to_s, #unknown_type?
Instance Method Details
89
90
91
|
# File 'lib/chitin/file.rb', line 89
def delete
File.safe_unlink @path
end
|
#executable?(force = false) ⇒ Boolean
93
94
95
|
# File 'lib/chitin/file.rb', line 93
def executable?(force=false)
@executable = force ? File.executable?(path) : @executable
end
|
#exists? ⇒ Boolean
79
80
81
|
# File 'lib/chitin/file.rb', line 79
def exists?
File.exists? path
end
|
97
98
99
|
# File 'lib/chitin/file.rb', line 97
def inspect
"#<Chitin::FileObject #{path.inspect}>"
end
|
#open(permissions, &block) ⇒ Object
83
84
85
86
87
|
# File 'lib/chitin/file.rb', line 83
def open(permissions, &block)
File.open path, permissions do |f|
block.call f
end
end
|
#readable?(force = false) ⇒ Boolean
71
72
73
|
# File 'lib/chitin/file.rb', line 71
def readable?(force=false)
@readable = force ? File.readable(path) : @readable
end
|
#writeable?(force = false) ⇒ Boolean
75
76
77
|
# File 'lib/chitin/file.rb', line 75
def writeable?(force=false)
@writeable = force ? File.writeable?(path) : @writeable
end
|