Method: ShatteredSupport::CoreExtensions::File::Search::ClassMethods#find

Defined in:
lib/shattered_support/core_ext/file/search.rb

#find(paths, file) ⇒ Object

Finds the first file matching ‘file’ in the given paths.

Raises:

  • (StandardError)


46
47
48
49
50
51
52
53
54
# File 'lib/shattered_support/core_ext/file/search.rb', line 46

def find(paths, file)
	paths = [paths] if paths.is_a? ::String
	paths.each do |path|
		each_in_path(path) do |resource|
			return resource if resource.ends_with?(file)
		end
	end
	raise StandardError.new("File not found #{file}")
end