Module: Homecoming

Defined in:
lib/homecoming.rb,
lib/homecoming/find.rb,
lib/homecoming/version.rb,
lib/homecoming/traversal.rb

Overview

Homecoming searches for a given filename in the current and all parent directories.

# Given the following directory structure:

/
  home/
    rrrene/
      projects/
        your_project/
          .yourconfig
      .yourconfig

Homecoming.find(".yourconfig", "/home/rrrene/projects/your_project")
# => ["/home/rrrene/.yourconfig",
      "/home/rrrene/projects/your_project/.yourconfig"]

If no path is given as second parameter, the current directory is the starting point of the traversal.

Defined Under Namespace

Classes: Find, Traversal

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.each(path = Dir.pwd, &block) ⇒ Object



30
31
32
# File 'lib/homecoming.rb', line 30

def self.each(path = Dir.pwd, &block)
  Homecoming::Traversal.new(path).each(&block)
end

.find(filename, path = Dir.pwd) ⇒ Object



26
27
28
# File 'lib/homecoming.rb', line 26

def self.find(filename, path = Dir.pwd)
  Homecoming::Find.new(filename, path).files
end