asyncable 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ef9015fc636d63b9da425016c8b34ec75749695
4
- data.tar.gz: d71f571ba10e29a5ba4bc5540a4fb8ca64112b8e
3
+ metadata.gz: e68b01ae5ca0dd3c40cac5276a9336243f9f9531
4
+ data.tar.gz: a4f17498b6edbdbf90209c76d32e8e6d1289b163
5
5
  SHA512:
6
- metadata.gz: c9e65dac21243a3da1f44a22bff6ea6cd15a40cfccca5c5fe0fb58e8b5e66709478e4ab7e11bd7f41895538e7728f63c1416a2f352bcad0edf4cae76bcb8f36d
7
- data.tar.gz: b16e5506bc3ec527c14caeeabd736ec3f9ce07ee48d3d657ee2b5dbaf2096d6407b800f907b4f58fa7b93ef62254a993325fc4a71562a1a0aa5a96ab7b7435a6
6
+ metadata.gz: 99428c1b053579647e52369fb214f0ad515e791bcade10147fcff65d206cce03116bf196f96134f61bb85239b14571c09e8a63f135625fcf034685f32a861eec
7
+ data.tar.gz: 0be6f45dcb6489b095f342113adc6e1308937a17062258b76b4a22dd3273c78f7a90ba3235af43ec5699775bbc8a99bdf07ad475c8f078a1c01cb9e9da5804c1
Binary file
@@ -1,3 +1,3 @@
1
1
  module Asyncable
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
data/lib/asyncable.rb CHANGED
@@ -15,7 +15,7 @@ module Asyncable
15
15
 
16
16
  def start_async
17
17
  self.status = Statuses::PROCESSING
18
- save
18
+ save_to_db
19
19
  process_in_background
20
20
  end
21
21
 
@@ -33,6 +33,12 @@ module Asyncable
33
33
 
34
34
  private
35
35
 
36
+ # === INTERFACE METHODS ===
37
+ def async_operation
38
+ fail "async_operation method is required for #{self.class.name}"
39
+ end
40
+ # === END INTERFACE METHODS ===
41
+
36
42
  def process_in_background
37
43
  begin
38
44
  async_operation
@@ -43,7 +49,6 @@ module Asyncable
43
49
  end
44
50
  handle_asynchronously :process_in_background
45
51
 
46
-
47
52
  def async_complete!
48
53
  success!
49
54
  after_async_complete
@@ -51,26 +56,19 @@ module Asyncable
51
56
 
52
57
  def success!
53
58
  self.status = Statuses::SUCCEEDED
54
- save
59
+ save_to_db
55
60
  end
56
61
 
57
62
  def failed!(error)
58
63
  self.status = Statuses::FAILED
59
- save
64
+ save_to_db
60
65
  handle_async_error(error)
61
66
  end
62
67
 
63
- # === INTERFACE ===
64
- def async_operation
65
- fail "async_operation method is required for #{self.class.name}"
66
- end
67
-
68
- def save
69
- fail "save method is required for #{self.class.name}"
68
+ # === HOOKS ===
69
+ def save_to_db
70
70
  end
71
- # === END INTERFACE ===
72
71
 
73
- # === HOOKS ===
74
72
  def after_async_complete
75
73
  end
76
74
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asyncable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Francis
@@ -79,6 +79,7 @@ files:
79
79
  - Gemfile
80
80
  - README.md
81
81
  - Rakefile
82
+ - asyncable-0.1.3.gem
82
83
  - asyncable.gemspec
83
84
  - bin/console
84
85
  - bin/setup