otaku 0.2.2 → 0.3.0
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/HISTORY.txt +8 -0
- data/README.rdoc +18 -5
- data/VERSION +1 -1
- data/examples/unittest/client.rb +17 -0
- data/examples/unittest/server.rb +56 -0
- data/examples/unittest/server2.rb +11 -0
- data/examples/unittest/tests/a_test.rb +9 -0
- data/examples/unittest/tests/b_test.rb +9 -0
- data/lib/otaku.rb +1 -0
- data/lib/otaku/handler.rb +16 -108
- data/lib/otaku/handler/context.rb +43 -0
- data/lib/otaku/handler/magic_proc.rb +116 -0
- data/lib/otaku/handler/processor.rb +78 -0
- data/otaku.gemspec +11 -3
- data/spec/handler_spec.rb +905 -23
- data/spec/integration_spec.rb +6 -1
- metadata +17 -4
data/spec/integration_spec.rb
CHANGED
@@ -32,11 +32,16 @@ describe "Otaku Service" do
|
|
32
32
|
message.should.match(/#<NameError: undefined local variable or method `mark' for /)
|
33
33
|
end
|
34
34
|
|
35
|
-
should 'succeed w proc that has contextual reference & has context specified' do
|
35
|
+
should 'succeed w proc that has non-proc contextual reference & has context specified' do
|
36
36
|
Otaku.start(:mark => '*') {|data| '%s %s %s' % [mark, data, mark] }
|
37
37
|
Otaku.process('hello').should.equal('* hello *')
|
38
38
|
end
|
39
39
|
|
40
|
+
should 'succeed w proc that has proc contextual reference & has context specified' do
|
41
|
+
Otaku.start(:mark => lambda { '*' }) {|data| '%s %s %s' % [mark.call, data, mark.call] }
|
42
|
+
Otaku.process('hello').should.equal('* hello *')
|
43
|
+
end
|
44
|
+
|
40
45
|
should 'reflect __FILE__ as captured when declaring proc' do
|
41
46
|
Otaku.start{|data| __FILE__ }
|
42
47
|
Otaku.process(:watever_data).should.equal(File.expand_path(__FILE__))
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- NgTzeYang
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-08-05 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -101,11 +101,19 @@ files:
|
|
101
101
|
- lib/otaku/client.rb
|
102
102
|
- lib/otaku/encoder.rb
|
103
103
|
- lib/otaku/handler.rb
|
104
|
+
- lib/otaku/handler/context.rb
|
105
|
+
- lib/otaku/handler/magic_proc.rb
|
106
|
+
- lib/otaku/handler/processor.rb
|
104
107
|
- lib/otaku/server.rb
|
105
108
|
- otaku.gemspec
|
106
109
|
- spec/handler_spec.rb
|
107
110
|
- spec/integration_spec.rb
|
108
111
|
- spec/spec_helper.rb
|
112
|
+
- examples/unittest/client.rb
|
113
|
+
- examples/unittest/tests/b_test.rb
|
114
|
+
- examples/unittest/tests/a_test.rb
|
115
|
+
- examples/unittest/server.rb
|
116
|
+
- examples/unittest/server2.rb
|
109
117
|
has_rdoc: true
|
110
118
|
homepage: http://github.com/ngty/otaku
|
111
119
|
licenses: []
|
@@ -144,3 +152,8 @@ test_files:
|
|
144
152
|
- spec/integration_spec.rb
|
145
153
|
- spec/handler_spec.rb
|
146
154
|
- spec/spec_helper.rb
|
155
|
+
- examples/unittest/client.rb
|
156
|
+
- examples/unittest/tests/b_test.rb
|
157
|
+
- examples/unittest/tests/a_test.rb
|
158
|
+
- examples/unittest/server.rb
|
159
|
+
- examples/unittest/server2.rb
|