lib/homecoming/find.rb in homecoming-0.1.0 vs lib/homecoming/find.rb in homecoming-0.1.1
- old
+ new
@@ -21,14 +21,12 @@
# Homecoming.find(".yourconfig", "/home/rrrene/projects/your_project")
# # => ["/home/rrrene/.yourconfig",
# "/home/rrrene/projects/your_project/.yourconfig"]
#
def files
- found_files = []
- Traversal.new(@start_dir) do |dir|
+ Traversal.new(@start_dir).map do |dir|
filename = File.join(dir, @filename)
- found_files.unshift filename if File.exist?(filename)
- end
- found_files
+ File.exist?(filename) ? filename : nil
+ end.compact.reverse
end
end
-end
\ No newline at end of file
+end