simplews 1.10.0 → 1.10.1

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.
Files changed (2) hide show
  1. data/lib/simplews/notifier.rb +14 -2
  2. metadata +3 -3
@@ -27,11 +27,23 @@ class SimpleWS::Jobs::Notifier
27
27
  @smtp_host = options[:smtp_host] || 'localhost'
28
28
  @smtp_port = options[:smtp_port] || 25
29
29
  @sleep_time = options[:sleep_time] || 2
30
- @jobs = {}
30
+ @filename = options[:filename]
31
+
32
+ if @filename && File.exists?(@filename)
33
+ @jobs = Marshal.load(File.open(@filename))
34
+ else
35
+ @jobs = {}
36
+ end
31
37
  end
32
38
 
33
39
  def add_job(job_id, email)
34
40
  @jobs[job_id] = email
41
+ File.open(@filename, 'w') do |f| f.write Marshal.dump(@jobs) end if @filename
42
+ end
43
+
44
+ def delete_job(job_id)
45
+ @jobs.delete(job_id)
46
+ File.open(@filename, 'w') do |f| f.write Marshal.dump(@jobs) end if @filename
35
47
  end
36
48
 
37
49
  def process
@@ -42,7 +54,7 @@ class SimpleWS::Jobs::Notifier
42
54
  else
43
55
  success(job_id, email)
44
56
  end
45
- @jobs.delete(job_id)
57
+ delete_job(job_id)
46
58
  end
47
59
  end
48
60
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 10
8
- - 0
9
- version: 1.10.0
8
+ - 1
9
+ version: 1.10.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Miguel Vazquez
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-12 00:00:00 +02:00
17
+ date: 2010-04-16 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency