Class: Annal::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/annal/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ Collection

Returns a new instance of Collection.



4
5
6
7
# File 'lib/annal/collection.rb', line 4

def initialize(dir)
  self.dir = dir
  self.dir_source = Dir.glob(dir)
end

Instance Attribute Details

#dirObject

Returns the value of attribute dir.



3
4
5
# File 'lib/annal/collection.rb', line 3

def dir
  @dir
end

#dir_sourceObject

Returns the value of attribute dir_source.



3
4
5
# File 'lib/annal/collection.rb', line 3

def dir_source
  @dir_source
end

Instance Method Details

#documentsObject



13
14
15
# File 'lib/annal/collection.rb', line 13

def documents
  file_paths.collect {|fp| Document.find(fp) }
end

#file_pathsObject



9
10
11
# File 'lib/annal/collection.rb', line 9

def file_paths
  dir_source.select {|path| File.file?(path) }
end