mailhandler 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ec9ad0acba66aa31321e63ed9f9acf9b95f57ea
4
- data.tar.gz: 16279973b129e4a3f384e7cfdaa025603b6b3814
3
+ metadata.gz: 1a751f124dd303e1b4e75ff52ae565512bee6a7a
4
+ data.tar.gz: 14ccbb2fb176a70ab1981a8aea2416f46919bd81
5
5
  SHA512:
6
- metadata.gz: 04381e76cc9adc9b6bfa1e2d649957cf60a2fbd1f5b2da7fa08d50d51d2e6fe3beaa61d13de6a4dcde7719c24c5affe8519d4bc13e97364a94a0ecf5e812d7fe
7
- data.tar.gz: e0c657384c7679083bbe7047738fb2fb810fe58e9562a3a7ed9fd3d764178d155ce905a82e2722520786af049dbfbfe4aab991ed0e9d7e9b0a764f7401764a0f
6
+ metadata.gz: eb0aca2c27d1a6a5a930ddcaf2791a7c903656ed0ce7577ec1fda0119dac6971fcffc5cb6b0d11d1adcbe62cc47b8615b3c0b61eb9818f742b5d52325fa00182
7
+ data.tar.gz: 902717c5ff6db0d68db91faacd4970983c750942ba29b4de483e1d16e2a143e743cff357bf5fcf6f04e2473014de138f63a7f1cf69286e76bb599f5bae4ace71
@@ -1,8 +1,57 @@
1
- require_relative 'base.rb'
1
+ require 'fileutils'
2
2
 
3
- # Implementations of base filtering, which will allow further filtering the list of files based on email content.
4
3
  module Filter
5
4
 
5
+ # Base filtering class, which is used for reading list of all files based on passed pattern.
6
+ # Patterns to be used can be checked here: http://ruby-doc.org/core-1.9.3/Dir.html
7
+ class Base
8
+
9
+ def Base.sort(files)
10
+
11
+ swapped = true
12
+ j = 0
13
+
14
+ while swapped do
15
+
16
+ swapped = false
17
+ j+=1
18
+
19
+ (files.size - j).times do |i|
20
+
21
+ if File.new(files[i]).ctime < File.new(files[i + 1]).ctime
22
+ tmp = files[i]
23
+ files[i] = files[i + 1]
24
+ files[i + 1] = tmp
25
+ swapped = true
26
+
27
+ end
28
+
29
+ end
30
+
31
+ end
32
+
33
+ files
34
+
35
+ end
36
+
37
+ def get(pattern)
38
+
39
+ files = []
40
+ Dir.glob(pattern).each { |file| files << File.absolute_path(file) }
41
+ files
42
+
43
+ end
44
+
45
+ protected
46
+
47
+ def read_email(content)
48
+
49
+ Mail.read_from_string(content)
50
+
51
+ end
52
+
53
+ end
54
+
6
55
  class ByFilename < Base
7
56
 
8
57
  def get(pattern)
@@ -1,8 +1,6 @@
1
1
  require 'mail'
2
2
  require_relative 'base.rb'
3
3
  require_relative '../errors'
4
-
5
- require_relative 'file_filter/base.rb'
6
4
  require_relative 'file_filter/filter.rb'
7
5
 
8
6
  module MailHandler
@@ -1,5 +1,5 @@
1
1
  module MailHandler
2
2
 
3
- VERSION = '1.0.14'
3
+ VERSION = '1.0.15'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailhandler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.14
4
+ version: 1.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Balos
@@ -62,7 +62,6 @@ files:
62
62
  - lib/mailhandler/errors.rb
63
63
  - lib/mailhandler/receiver.rb
64
64
  - lib/mailhandler/receiving/base.rb
65
- - lib/mailhandler/receiving/file_filter/base.rb
66
65
  - lib/mailhandler/receiving/file_filter/filter.rb
67
66
  - lib/mailhandler/receiving/folder.rb
68
67
  - lib/mailhandler/receiving/imap.rb
@@ -1,56 +0,0 @@
1
- require 'fileutils'
2
-
3
- # Base filtering class, which is used for reading list of all files based on passed pattern.
4
- # Patterns to be used can be checked here: http://ruby-doc.org/core-1.9.3/Dir.html
5
- module Filter
6
-
7
- class Base
8
-
9
- def Base.sort(files)
10
-
11
- swapped = true
12
- j = 0
13
-
14
- while swapped do
15
-
16
- swapped = false
17
- j+=1
18
-
19
- (files.size - j).times do |i|
20
-
21
- if File.new(files[i]).ctime < File.new(files[i + 1]).ctime
22
- tmp = files[i]
23
- files[i] = files[i + 1]
24
- files[i + 1] = tmp
25
- swapped = true
26
-
27
- end
28
-
29
- end
30
-
31
- end
32
-
33
- files
34
-
35
- end
36
-
37
- def get(pattern)
38
-
39
- files = []
40
- Dir.glob(pattern).each { |file| files << File.absolute_path(file) }
41
- files
42
-
43
- end
44
-
45
- protected
46
-
47
- def read_email(content)
48
-
49
- Mail.read_from_string(content)
50
-
51
- end
52
-
53
- end
54
-
55
- end
56
-