This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge pull request #23 from sstephenson/avoid-index-creations

Avoid index creations
  • Loading branch information...
josh committed Apr 9, 2013
2 parents c0ffe84 + 63cea24 commit 0f298b1212443aeac99c844749bbfb2ef1a1c3f2
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/hike/trail.rb
View
@@ -156,15 +156,19 @@ def index
# `Trail#entries` is equivalent to `Dir#entries`. It is not
# recommend to use this method for general purposes. It exists for
# parity with `Index#entries`.
- def entries(*args)
- index.entries(*args)
+ def entries(path)
+ Pathname.new(path).entries.reject { |entry| entry.to_s =~ /^\.|~$|^\#.*\#$/ }.sort
+ rescue Errno::ENOENT
+ []
end
# `Trail#stat` is equivalent to `File#stat`. It is not
# recommend to use this method for general purposes. It exists for
# parity with `Index#stat`.
- def stat(*args)
- index.stat(*args)
+ def stat(path)
+ File.stat(path.to_s)
+ rescue Errno::ENOENT
+ nil
end
private

0 comments on commit 0f298b1

Please sign in to comment.