Class: Chitin::Directory
Instance Attribute Summary
Attributes inherited from FSObject
#path, #search
Instance Method Summary
collapse
Methods inherited from FSObject
#each, #files, #lstat, #size, #symlink?, #to_a, #to_s, #unknown_type?
Constructor Details
#initialize(path, opts = {}) ⇒ Directory
Returns a new instance of Directory.
113
114
115
116
|
# File 'lib/chitin/file.rb', line 113
def initialize(path, opts={})
super
@search = proc { File.join self.path, '*' }
end
|
Instance Method Details
131
132
133
134
|
# File 'lib/chitin/file.rb', line 131
def delete
File.rm_rf path
end
|
#directory? ⇒ Boolean
140
141
142
|
# File 'lib/chitin/file.rb', line 140
def directory?
true
end
|
118
119
120
121
122
|
# File 'lib/chitin/file.rb', line 118
def down
@path = File.join path, '**'
@files = nil
self
end
|
136
137
138
|
# File 'lib/chitin/file.rb', line 136
def inspect
"#<Chitin::Directory #{path.inspect}>"
end
|
#level(n = 1) ⇒ Object
Get a specific level down
125
126
127
128
129
|
# File 'lib/chitin/file.rb', line 125
def level(n=1)
n.times { @path = File.join self.path, '*' }
@files = nil
self
end
|