Class: MailHandler::Receiving::FileList
- Inherits:
-
Object
- Object
- MailHandler::Receiving::FileList
- Includes:
- FileHandling
- Defined in:
- lib/mailhandler/receiving/filelist/base.rb,
lib/mailhandler/receiving/filelist/filter/base.rb,
lib/mailhandler/receiving/filelist/filter/email.rb
Defined Under Namespace
Modules: Filter
Instance Method Summary collapse
Methods included from FileHandling
Instance Method Details
#get(pattern) ⇒ Object
42 43 44 45 46 |
# File 'lib/mailhandler/receiving/filelist/base.rb', line 42 def get(pattern) Dir.glob(pattern) end |
#sort(files) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/mailhandler/receiving/filelist/base.rb', line 48 def sort(files) swapped = true j = 0 while swapped do swapped = false j+=1 (files.size - j).times do |i| file1 = access_file(files[i], false) { File.new(files[i]).ctime } file2 = access_file(files[i+1], false) { File.new(files[i+1]).ctime } if file1 && file2 && file1 < file2 tmp = files[i] files[i] = files[i + 1] files[i + 1] = tmp swapped = true end end end files end |