Method: Cabi::DataFile.bulk_selection

Defined in:
lib/datafile.rb

.bulk_selection(id, opts = {}) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/datafile.rb', line 73

def self.bulk_selection(id, opts={})
  contents  = []

  opts[:only_file]     ||= false

  Dir.glob( File.join( *self.id_array(id) ) ).each do |f|
    next if f == '.' or f == '..' or File.directory?(f)
    contents << (opts[:only_file] ? f : File.read(f)) if File.exists?(f)
  end

  contents
end