amirka-async-fu 1.1.0 → 1.1.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.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 1
4
- :patch: 0
4
+ :patch: 1
data/test/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Amir Mamedov
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/test/README.rdoc ADDED
@@ -0,0 +1,53 @@
1
+ = async-fu
2
+
3
+ async-fu improve your code with abilities to run long task in threaded way
4
+
5
+
6
+ == Examples
7
+ === Simple usage
8
+ class YourClass1
9
+ def hello
10
+ p 'incapsulated test'
11
+ p 'start'
12
+ p 'list ' + Thread.list.join( ' ')
13
+ p 'main ' + Thread.main.to_s
14
+ p 'this ' + Thread.current.to_s
15
+ p 'end'
16
+ end
17
+ end
18
+
19
+ af = AsyncFu.new(YourClass1.new)
20
+
21
+ af.hello
22
+ === Interitence usage
23
+ class YourClass2 < AsyncFu
24
+ def hello
25
+ p 'start'
26
+ p 'list ' + Thread.list.join( ' ')
27
+ p 'main ' + Thread.main.to_s
28
+ p 'this ' + Thread.current.to_s
29
+ p 'end'
30
+ end
31
+ end
32
+
33
+ ai = YourClass2.new
34
+
35
+ ai.hello
36
+ === Thread exit solution
37
+ You do not need more to use join method to lock threads, if you not use it for some reasons.
38
+
39
+ AsyncFu catch exit of ruby program and check for live threads pass main thread until they ended.
40
+
41
+ If you don't need this futures, you can switch it off by using exit method of AsyncFu class.
42
+ == TODO
43
+ === 1.x.x
44
+ * callbacks
45
+
46
+ === 2.x.x
47
+ * add mixin style
48
+ YourClass
49
+ include async-fu
50
+ end
51
+ == Copyright
52
+
53
+ Copyright (c) 2009 Amir Mamedov. See LICENSE for details.
data/test/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "async-fu"
8
+ gem.summary = %Q{TODO}
9
+ gem.email = "amir@mamedov.eu"
10
+ gem.homepage = "http://github.com/amirka/async-fu"
11
+ gem.authors = ["Amir Mamedov"]
12
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
13
+ end
14
+ rescue LoadError
15
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
16
+ end
17
+
18
+ require 'rake/rdoctask'
19
+ Rake::RDocTask.new do |rdoc|
20
+ rdoc.rdoc_dir = 'rdoc'
21
+ rdoc.title = 'async-fu'
22
+ rdoc.options << '--line-numbers' << '--inline-source'
23
+ rdoc.rdoc_files.include('README*')
24
+ rdoc.rdoc_files.include('lib/**/*.rb')
25
+ end
26
+
27
+ require 'rake/testtask'
28
+ Rake::TestTask.new(:test) do |test|
29
+ test.libs << 'lib' << 'test'
30
+ test.pattern = 'test/**/*_test.rb'
31
+ test.verbose = false
32
+ end
33
+
34
+ begin
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/*_test.rb'
39
+ test.verbose = true
40
+ end
41
+ rescue LoadError
42
+ task :rcov do
43
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
44
+ end
45
+ end
46
+
47
+
48
+ task :default => :test
data/test/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 1
3
+ :minor: 1
4
+ :patch: 0
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{async-fu}
5
+ s.version = "0.0.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Amir Mamedov"]
9
+ s.date = %q{2009-03-06}
10
+ s.email = %q{amir@mamedov.eu}
11
+ s.extra_rdoc_files = ["README.rdoc", "LICENSE"]
12
+ s.files = ["README.rdoc", "VERSION.yml", "lib/async_fu.rb", "test/async_fu_test.rb", "test/test_helper.rb", "LICENSE"]
13
+ s.has_rdoc = true
14
+ s.homepage = %q{http://github.com/amirka/async-fu}
15
+ s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
16
+ s.require_paths = ["lib"]
17
+ s.rubygems_version = %q{1.3.1}
18
+ s.summary = %q{TODO}
19
+
20
+ if s.respond_to? :specification_version then
21
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
22
+ s.specification_version = 2
23
+
24
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25
+ else
26
+ end
27
+ else
28
+ end
29
+ end
@@ -0,0 +1,24 @@
1
+ require 'fastthread'
2
+ class AsyncFu
3
+ def initialize(obj = nil)
4
+ @class = obj || self
5
+ @guard = Mutex.new
6
+ at_exit{
7
+ unless @exit
8
+ until Thread.list.size == 1 do Thread.pass end
9
+ end
10
+ }
11
+ end
12
+ def method_missing(name, *args)
13
+ if @class.respond_to?(name)
14
+ Thread.new{
15
+ @class.send name, *args
16
+ }
17
+ else
18
+ @class.send name, *args
19
+ end
20
+ end
21
+ def exit
22
+ @exit = true
23
+ end
24
+ end
@@ -0,0 +1,208 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: AsyncFu</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">AsyncFu</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/async_fu_rb.html">
59
+ lib/async_fu.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000003">exit</a>&nbsp;&nbsp;
90
+ <a href="#M000002">method_missing</a>&nbsp;&nbsp;
91
+ <a href="#M000001">new</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+
100
+ <div id="section">
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <!-- if method_list -->
110
+ <div id="methods">
111
+ <h3 class="section-bar">Public Class methods</h3>
112
+
113
+ <div id="method-M000001" class="method-detail">
114
+ <a name="M000001"></a>
115
+
116
+ <div class="method-heading">
117
+ <a href="#M000001" class="method-signature">
118
+ <span class="method-name">new</span><span class="method-args">(obj = '')</span>
119
+ </a>
120
+ </div>
121
+
122
+ <div class="method-description">
123
+ <p><a class="source-toggle" href="#"
124
+ onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
125
+ <div class="method-source-code" id="M000001-source">
126
+ <pre>
127
+ <span class="ruby-comment cmt"># File lib/async_fu.rb, line 3</span>
128
+ 3: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">obj</span> = <span class="ruby-value str">''</span>)
129
+ 4: <span class="ruby-ivar">@class</span> = <span class="ruby-identifier">obj</span> <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>
130
+ 5: <span class="ruby-ivar">@guard</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
131
+ 6: <span class="ruby-identifier">at_exit</span>{
132
+ 7: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@exit</span>
133
+ 8: <span class="ruby-keyword kw">until</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">do</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">pass</span> <span class="ruby-keyword kw">end</span>
134
+ 9: <span class="ruby-keyword kw">end</span>
135
+ 10: }
136
+ 11: <span class="ruby-keyword kw">end</span>
137
+ </pre>
138
+ </div>
139
+ </div>
140
+ </div>
141
+
142
+ <h3 class="section-bar">Public Instance methods</h3>
143
+
144
+ <div id="method-M000003" class="method-detail">
145
+ <a name="M000003"></a>
146
+
147
+ <div class="method-heading">
148
+ <a href="#M000003" class="method-signature">
149
+ <span class="method-name">exit</span><span class="method-args">()</span>
150
+ </a>
151
+ </div>
152
+
153
+ <div class="method-description">
154
+ <p><a class="source-toggle" href="#"
155
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
156
+ <div class="method-source-code" id="M000003-source">
157
+ <pre>
158
+ <span class="ruby-comment cmt"># File lib/async_fu.rb, line 21</span>
159
+ 21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exit</span>
160
+ 22: <span class="ruby-ivar">@exit</span> = <span class="ruby-keyword kw">true</span>
161
+ 23: <span class="ruby-keyword kw">end</span>
162
+ </pre>
163
+ </div>
164
+ </div>
165
+ </div>
166
+
167
+ <div id="method-M000002" class="method-detail">
168
+ <a name="M000002"></a>
169
+
170
+ <div class="method-heading">
171
+ <a href="#M000002" class="method-signature">
172
+ <span class="method-name">method_missing</span><span class="method-args">(name, *args)</span>
173
+ </a>
174
+ </div>
175
+
176
+ <div class="method-description">
177
+ <p><a class="source-toggle" href="#"
178
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
179
+ <div class="method-source-code" id="M000002-source">
180
+ <pre>
181
+ <span class="ruby-comment cmt"># File lib/async_fu.rb, line 12</span>
182
+ 12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
183
+ 13: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@class</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">name</span>)
184
+ 14: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>{
185
+ 15: <span class="ruby-ivar">@class</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
186
+ 16: }
187
+ 17: <span class="ruby-keyword kw">else</span>
188
+ 18: <span class="ruby-ivar">@class</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
189
+ 19: <span class="ruby-keyword kw">end</span>
190
+ 20: <span class="ruby-keyword kw">end</span>
191
+ </pre>
192
+ </div>
193
+ </div>
194
+ </div>
195
+
196
+
197
+ </div>
198
+
199
+
200
+ </div>
201
+
202
+
203
+ <div id="validator-badges">
204
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
205
+ </div>
206
+
207
+ </body>
208
+ </html>
@@ -0,0 +1 @@
1
+ Fri, 06 Mar 2009 02:55:25 +0300
@@ -0,0 +1,188 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: README.rdoc</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>README.rdoc</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>README.rdoc
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Fri Mar 06 02:55:19 +0300 2009</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <h1>async-fu</h1>
73
+ <p>
74
+ async-fu improve your code with abilities to run long task in threaded way
75
+ </p>
76
+ <h2>Examples</h2>
77
+ <h3>Simple usage</h3>
78
+ <p>
79
+ class YourClass1
80
+ </p>
81
+ <pre>
82
+ def hello
83
+ p 'incapsulated test'
84
+ p 'start'
85
+ p 'list ' + Thread.list.join( ' ')
86
+ p 'main ' + Thread.main.to_s
87
+ p 'this ' + Thread.current.to_s
88
+ p 'end'
89
+ end
90
+ </pre>
91
+ <p>
92
+ end
93
+ </p>
94
+ <p>
95
+ af = <a
96
+ href="../classes/AsyncFu.html#M000001">AsyncFu.new(YourClass1.new)</a>
97
+ </p>
98
+ <p>
99
+ af.hello
100
+ </p>
101
+ <h3>Interitence usage</h3>
102
+ <p>
103
+ class YourClass2 &lt; <a href="../classes/AsyncFu.html">AsyncFu</a>
104
+ </p>
105
+ <pre>
106
+ def hello
107
+ p 'start'
108
+ p 'list ' + Thread.list.join( ' ')
109
+ p 'main ' + Thread.main.to_s
110
+ p 'this ' + Thread.current.to_s
111
+ p 'end'
112
+ end
113
+ </pre>
114
+ <p>
115
+ end
116
+ </p>
117
+ <p>
118
+ ai = YourClass2.new
119
+ </p>
120
+ <p>
121
+ ai.hello
122
+ </p>
123
+ <h3>Thread exit solution</h3>
124
+ <p>
125
+ You do not need more to use join method to lock threads, if you not use it
126
+ for some reasons.
127
+ </p>
128
+ <p>
129
+ <a href="../classes/AsyncFu.html">AsyncFu</a> catch exit of ruby program
130
+ and check for live threads pass main thread until they ended.
131
+ </p>
132
+ <p>
133
+ If you don&#8216;t need this futures, you can switch it off by using exit
134
+ method of <a href="../classes/AsyncFu.html">AsyncFu</a> class.
135
+ </p>
136
+ <h2>TODO</h2>
137
+ <h3>1.x.x</h3>
138
+ <ul>
139
+ <li>callbacks
140
+
141
+ </li>
142
+ </ul>
143
+ <h3>2.x.x</h3>
144
+ <ul>
145
+ <li>add mixin style
146
+
147
+ </li>
148
+ </ul>
149
+ <p>
150
+ YourClass include async-fu end
151
+ </p>
152
+ <h2>Copyright</h2>
153
+ <p>
154
+ Copyright (c) 2009 Amir Mamedov. See LICENSE for details.
155
+ </p>
156
+
157
+ </div>
158
+
159
+
160
+ </div>
161
+
162
+
163
+ </div>
164
+
165
+
166
+ <!-- if includes -->
167
+
168
+ <div id="section">
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+ <!-- if method_list -->
178
+
179
+
180
+ </div>
181
+
182
+
183
+ <div id="validator-badges">
184
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
185
+ </div>
186
+
187
+ </body>
188
+ </html>
@@ -0,0 +1,108 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: async_fu.rb</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>async_fu.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/async_fu.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Fri Mar 06 02:44:12 +0300 2009</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+ <div id="requires-list">
73
+ <h3 class="section-bar">Required files</h3>
74
+
75
+ <div class="name-list">
76
+ fastthread&nbsp;&nbsp;
77
+ </div>
78
+ </div>
79
+
80
+ </div>
81
+
82
+
83
+ </div>
84
+
85
+
86
+ <!-- if includes -->
87
+
88
+ <div id="section">
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <!-- if method_list -->
98
+
99
+
100
+ </div>
101
+
102
+
103
+ <div id="validator-badges">
104
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
105
+ </div>
106
+
107
+ </body>
108
+ </html>
@@ -0,0 +1,27 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Classes
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Classes</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Classes</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/AsyncFu.html">AsyncFu</a><br />
24
+ </div>
25
+ </div>
26
+ </body>
27
+ </html>
@@ -0,0 +1,28 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Files
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Files</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Files</h1>
22
+ <div id="index-entries">
23
+ <a href="files/README_rdoc.html">README.rdoc</a><br />
24
+ <a href="files/lib/async_fu_rb.html">lib/async_fu.rb</a><br />
25
+ </div>
26
+ </div>
27
+ </body>
28
+ </html>
@@ -0,0 +1,29 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Methods
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Methods</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Methods</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/AsyncFu.html#M000003">exit (AsyncFu)</a><br />
24
+ <a href="classes/AsyncFu.html#M000002">method_missing (AsyncFu)</a><br />
25
+ <a href="classes/AsyncFu.html#M000001">new (AsyncFu)</a><br />
26
+ </div>
27
+ </div>
28
+ </body>
29
+ </html>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
5
+
6
+ <!--
7
+
8
+ async-fu
9
+
10
+ -->
11
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
+ <head>
13
+ <title>async-fu</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ </head>
16
+ <frameset rows="20%, 80%">
17
+ <frameset cols="25%,35%,45%">
18
+ <frame src="fr_file_index.html" title="Files" name="Files" />
19
+ <frame src="fr_class_index.html" name="Classes" />
20
+ <frame src="fr_method_index.html" name="Methods" />
21
+ </frameset>
22
+ <frame src="files/README_rdoc.html" name="docwin" />
23
+ </frameset>
24
+ </html>
@@ -0,0 +1,208 @@
1
+
2
+ body {
3
+ font-family: Verdana,Arial,Helvetica,sans-serif;
4
+ font-size: 90%;
5
+ margin: 0;
6
+ margin-left: 40px;
7
+ padding: 0;
8
+ background: white;
9
+ }
10
+
11
+ h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
12
+ h1 { font-size: 150%; }
13
+ h2,h3,h4 { margin-top: 1em; }
14
+
15
+ a { background: #eef; color: #039; text-decoration: none; }
16
+ a:hover { background: #039; color: #eef; }
17
+
18
+ /* Override the base stylesheet's Anchor inside a table cell */
19
+ td > a {
20
+ background: transparent;
21
+ color: #039;
22
+ text-decoration: none;
23
+ }
24
+
25
+ /* and inside a section title */
26
+ .section-title > a {
27
+ background: transparent;
28
+ color: #eee;
29
+ text-decoration: none;
30
+ }
31
+
32
+ /* === Structural elements =================================== */
33
+
34
+ div#index {
35
+ margin: 0;
36
+ margin-left: -40px;
37
+ padding: 0;
38
+ font-size: 90%;
39
+ }
40
+
41
+
42
+ div#index a {
43
+ margin-left: 0.7em;
44
+ }
45
+
46
+ div#index .section-bar {
47
+ margin-left: 0px;
48
+ padding-left: 0.7em;
49
+ background: #ccc;
50
+ font-size: small;
51
+ }
52
+
53
+
54
+ div#classHeader, div#fileHeader {
55
+ width: auto;
56
+ color: white;
57
+ padding: 0.5em 1.5em 0.5em 1.5em;
58
+ margin: 0;
59
+ margin-left: -40px;
60
+ border-bottom: 3px solid #006;
61
+ }
62
+
63
+ div#classHeader a, div#fileHeader a {
64
+ background: inherit;
65
+ color: white;
66
+ }
67
+
68
+ div#classHeader td, div#fileHeader td {
69
+ background: inherit;
70
+ color: white;
71
+ }
72
+
73
+
74
+ div#fileHeader {
75
+ background: #057;
76
+ }
77
+
78
+ div#classHeader {
79
+ background: #048;
80
+ }
81
+
82
+
83
+ .class-name-in-header {
84
+ font-size: 180%;
85
+ font-weight: bold;
86
+ }
87
+
88
+
89
+ div#bodyContent {
90
+ padding: 0 1.5em 0 1.5em;
91
+ }
92
+
93
+ div#description {
94
+ padding: 0.5em 1.5em;
95
+ background: #efefef;
96
+ border: 1px dotted #999;
97
+ }
98
+
99
+ div#description h1,h2,h3,h4,h5,h6 {
100
+ color: #125;;
101
+ background: transparent;
102
+ }
103
+
104
+ div#validator-badges {
105
+ text-align: center;
106
+ }
107
+ div#validator-badges img { border: 0; }
108
+
109
+ div#copyright {
110
+ color: #333;
111
+ background: #efefef;
112
+ font: 0.75em sans-serif;
113
+ margin-top: 5em;
114
+ margin-bottom: 0;
115
+ padding: 0.5em 2em;
116
+ }
117
+
118
+
119
+ /* === Classes =================================== */
120
+
121
+ table.header-table {
122
+ color: white;
123
+ font-size: small;
124
+ }
125
+
126
+ .type-note {
127
+ font-size: small;
128
+ color: #DEDEDE;
129
+ }
130
+
131
+ .xxsection-bar {
132
+ background: #eee;
133
+ color: #333;
134
+ padding: 3px;
135
+ }
136
+
137
+ .section-bar {
138
+ color: #333;
139
+ border-bottom: 1px solid #999;
140
+ margin-left: -20px;
141
+ }
142
+
143
+
144
+ .section-title {
145
+ background: #79a;
146
+ color: #eee;
147
+ padding: 3px;
148
+ margin-top: 2em;
149
+ margin-left: -30px;
150
+ border: 1px solid #999;
151
+ }
152
+
153
+ .top-aligned-row { vertical-align: top }
154
+ .bottom-aligned-row { vertical-align: bottom }
155
+
156
+ /* --- Context section classes ----------------------- */
157
+
158
+ .context-row { }
159
+ .context-item-name { font-family: monospace; font-weight: bold; color: black; }
160
+ .context-item-value { font-size: small; color: #448; }
161
+ .context-item-desc { color: #333; padding-left: 2em; }
162
+
163
+ /* --- Method classes -------------------------- */
164
+ .method-detail {
165
+ background: #efefef;
166
+ padding: 0;
167
+ margin-top: 0.5em;
168
+ margin-bottom: 1em;
169
+ border: 1px dotted #ccc;
170
+ }
171
+ .method-heading {
172
+ color: black;
173
+ background: #ccc;
174
+ border-bottom: 1px solid #666;
175
+ padding: 0.2em 0.5em 0 0.5em;
176
+ }
177
+ .method-signature { color: black; background: inherit; }
178
+ .method-name { font-weight: bold; }
179
+ .method-args { font-style: italic; }
180
+ .method-description { padding: 0 0.5em 0 0.5em; }
181
+
182
+ /* --- Source code sections -------------------- */
183
+
184
+ a.source-toggle { font-size: 90%; }
185
+ div.method-source-code {
186
+ background: #262626;
187
+ color: #ffdead;
188
+ margin: 1em;
189
+ padding: 0.5em;
190
+ border: 1px dashed #999;
191
+ overflow: hidden;
192
+ }
193
+
194
+ div.method-source-code pre { color: #ffdead; overflow: hidden; }
195
+
196
+ /* --- Ruby keyword styles --------------------- */
197
+
198
+ .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
199
+
200
+ .ruby-constant { color: #7fffd4; background: transparent; }
201
+ .ruby-keyword { color: #00ffff; background: transparent; }
202
+ .ruby-ivar { color: #eedd82; background: transparent; }
203
+ .ruby-operator { color: #00ffee; background: transparent; }
204
+ .ruby-identifier { color: #ffdead; background: transparent; }
205
+ .ruby-node { color: #ffa07a; background: transparent; }
206
+ .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
207
+ .ruby-regexp { color: #ffa07a; background: transparent; }
208
+ .ruby-value { color: #7fffd4; background: transparent; }
data/test/test-1.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'rubygems'
2
+ require 'lib/async_fu.rb'
3
+
4
+ class YourClass1
5
+ def hello
6
+ p 'start'
7
+ p 'list ' + Thread.list.join( ' ')
8
+ p 'main ' + Thread.main.to_s
9
+ p 'this ' + Thread.current.to_s
10
+ p 'end'
11
+ end
12
+ end
13
+
14
+ af = AsyncFu.new(YourClass1.new)
15
+ #af.hello
16
+
17
+ class YourClass2 < AsyncFu
18
+ def hello
19
+ p 'start'
20
+ p 'list ' + Thread.list.join( ' ')
21
+ p 'main ' + Thread.main.to_s
22
+ p 'this ' + Thread.current.to_s
23
+ p 'end'
24
+ end
25
+ end
26
+
27
+ ai = YourClass2.new
28
+ ai.hello
29
+ p ai.methods
30
+ ai.exit
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amirka-async-fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amir Mamedov
@@ -26,6 +26,27 @@ files:
26
26
  - README.rdoc
27
27
  - VERSION.yml
28
28
  - lib/async_fu.rb
29
+ - test/async-fu.gemspec
30
+ - test/lib
31
+ - test/lib/async_fu.rb
32
+ - test/LICENSE
33
+ - test/Rakefile
34
+ - test/rdoc
35
+ - test/rdoc/classes
36
+ - test/rdoc/classes/AsyncFu.html
37
+ - test/rdoc/created.rid
38
+ - test/rdoc/files
39
+ - test/rdoc/files/lib
40
+ - test/rdoc/files/lib/async_fu_rb.html
41
+ - test/rdoc/files/README_rdoc.html
42
+ - test/rdoc/fr_class_index.html
43
+ - test/rdoc/fr_file_index.html
44
+ - test/rdoc/fr_method_index.html
45
+ - test/rdoc/index.html
46
+ - test/rdoc/rdoc-style.css
47
+ - test/README.rdoc
48
+ - test/test-1.rb
49
+ - test/VERSION.yml
29
50
  - LICENSE
30
51
  has_rdoc: true
31
52
  homepage: http://github.com/amirka/async-fu