Sha256: 7032e67f7bb72bf1e1731ac088dcac0a2d74c6d247c82dd3f6849347aa6fa5da

Contents?: true

Size: 851 Bytes

Versions: 1

Compression:

Stored size: 851 Bytes

Contents

require "homecoming/find"
require "homecoming/traversal"
require "homecoming/version"

# 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.
#
module Homecoming
  def self.find(filename, path = Dir.pwd)
    Homecoming::Find.new(filename, path).files
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
homecoming-0.1.1 lib/homecoming.rb