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 +4 -4
- data/asyncable-0.1.3.gem +0 -0
- data/lib/asyncable/version.rb +1 -1
- data/lib/asyncable.rb +11 -13
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e68b01ae5ca0dd3c40cac5276a9336243f9f9531
|
4
|
+
data.tar.gz: a4f17498b6edbdbf90209c76d32e8e6d1289b163
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99428c1b053579647e52369fb214f0ad515e791bcade10147fcff65d206cce03116bf196f96134f61bb85239b14571c09e8a63f135625fcf034685f32a861eec
|
7
|
+
data.tar.gz: 0be6f45dcb6489b095f342113adc6e1308937a17062258b76b4a22dd3273c78f7a90ba3235af43ec5699775bbc8a99bdf07ad475c8f078a1c01cb9e9da5804c1
|
data/asyncable-0.1.3.gem
ADDED
Binary file
|
data/lib/asyncable/version.rb
CHANGED
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
|
-
|
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
|
-
|
59
|
+
save_to_db
|
55
60
|
end
|
56
61
|
|
57
62
|
def failed!(error)
|
58
63
|
self.status = Statuses::FAILED
|
59
|
-
|
64
|
+
save_to_db
|
60
65
|
handle_async_error(error)
|
61
66
|
end
|
62
67
|
|
63
|
-
# ===
|
64
|
-
def
|
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
|
+
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
|