Module: Configature::Directory
- Defined in:
- lib/configature/directory.rb
Class Method Summary collapse
Class Method Details
.find(name) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/configature/directory.rb', line 16 def self.find(name) parents(Dir.pwd).lazy.map do |dir| File.(name, dir) end.find do |dir| File.directory?(dir) end end |
.parents(dir) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/configature/directory.rb', line 2 def self.parents(dir) Enumerator.new do |y| y << dir loop do last, dir = dir, File.('../', dir) break if (last == dir) y << dir end end end |