Sha256: f42795371e940a81af7cc791addf4ad61e11d1f1c2b666f4027aedd9fe0b6c97
Contents?: true
Size: 618 Bytes
Versions: 4
Compression:
Stored size: 618 Bytes
Contents
module Hike class DirectoryIndex def initialize expire_cache end def expire_cache @entries = {} @files = {} true end def entries(dirname) dirname = File.expand_path(dirname) @entries[dirname] ||= if File.directory?(dirname) Dir.entries(dirname).reject do |entry| entry =~ /^\.\.?$/ end.sort else [] end end def files(dirname) dirname = File.expand_path(dirname) @files[dirname] ||= entries(dirname).select do |entry| File.file?(File.join(dirname, entry)) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
hike-0.4.0 | lib/hike/directory_index.rb |
hike-0.3.0 | lib/hike/directory_index.rb |
hike-0.2.0 | lib/hike/directory_index.rb |
hike-0.1.5 | lib/hike/directory_index.rb |