amirka-async-fu 1.1.3 → 1.1.4
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.
- data/README.rdoc +34 -36
- data/VERSION.yml +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
|
@@ -6,41 +6,39 @@ async-fu improve your code with abilities to run long task in threaded way
|
|
|
6
6
|
|
|
7
7
|
=== Simple usage
|
|
8
8
|
|
|
9
|
-
require 'rubygems'
|
|
10
|
-
require 'async_fu'
|
|
11
|
-
|
|
12
|
-
class YourClass1
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
af = AsyncFu.new(YourClass1.new)
|
|
23
|
-
|
|
24
|
-
af.hello
|
|
9
|
+
require 'rubygems'
|
|
10
|
+
require 'async_fu'
|
|
11
|
+
|
|
12
|
+
class YourClass1
|
|
13
|
+
def hello
|
|
14
|
+
p 'start'
|
|
15
|
+
p 'list ' + Thread.list.join( ' ')
|
|
16
|
+
p 'main ' + Thread.main.to_s
|
|
17
|
+
p 'this ' + Thread.current.to_s
|
|
18
|
+
p 'end'
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
af = AsyncFu.new(YourClass1.new)
|
|
23
|
+
af.hello
|
|
25
24
|
|
|
26
25
|
=== Inheritance usage
|
|
27
26
|
|
|
28
|
-
require 'rubygems'
|
|
29
|
-
require 'async_fu'
|
|
30
|
-
|
|
31
|
-
class YourClass2 < AsyncFu
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
ai = YourClass2.new
|
|
42
|
-
|
|
43
|
-
ai.hello
|
|
27
|
+
require 'rubygems'
|
|
28
|
+
require 'async_fu'
|
|
29
|
+
|
|
30
|
+
class YourClass2 < AsyncFu
|
|
31
|
+
def hello
|
|
32
|
+
p 'start'
|
|
33
|
+
p 'list ' + Thread.list.join( ' ')
|
|
34
|
+
p 'main ' + Thread.main.to_s
|
|
35
|
+
p 'this ' + Thread.current.to_s
|
|
36
|
+
p 'end'
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
ai = YourClass2.new
|
|
41
|
+
ai.hello
|
|
44
42
|
|
|
45
43
|
=== Thread exit solution
|
|
46
44
|
|
|
@@ -60,10 +58,10 @@ If you don't need this futures, you can switch it off by using exit method of As
|
|
|
60
58
|
|
|
61
59
|
* add mixin style
|
|
62
60
|
|
|
63
|
-
YourClass
|
|
64
|
-
|
|
65
|
-
end
|
|
61
|
+
class YourClass
|
|
62
|
+
include async-fu
|
|
63
|
+
end
|
|
66
64
|
|
|
67
65
|
== Copyright
|
|
68
66
|
|
|
69
|
-
Copyright (c) 2009 Amir Mamedov. See LICENSE for details.
|
|
67
|
+
Copyright (c) 2009 Amir Mamedov. See LICENSE for details.
|
data/VERSION.yml
CHANGED