lib/annal/collection.rb in annal-0.0.3 vs lib/annal/collection.rb in annal-0.0.4
- old
+ new
@@ -1,13 +1,14 @@
module Annal
class Collection
- attr_accessor :dir
+ attr_accessor :dir, :dir_source
def initialize(dir)
self.dir = dir
+ self.dir_source = Dir.glob(dir)
end
- def file_paths(glob_match = '*')
- Dir.glob("#{dir}/#{glob_match}").select {|path| File.file?(path) }
+ def file_paths
+ dir_source.select {|path| File.file?(path) }
end
def documents
file_paths.collect {|fp| Document.find(fp) }
end