asir 1.2.9 → 1.2.10

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 2012-06-20 Kurt A. Stephens <ks.github@kurtstephens.com>
2
+
3
+ * v1.2.10: New Version: New Functionality.
4
+ * Transport#around_serve_message callback.
5
+
1
6
  2012-06-19 Kurt A. Stephens <ks.github@kurtstephens.com>
2
7
 
3
8
  * v1.2.9: New Version: Fixes, New Functionality.
@@ -13,6 +13,14 @@ begin
13
13
  [ASIR::Coder::Marshal.new,
14
14
  ASIR::Coder::Base64.new, ])
15
15
  server_process do
16
+ t.around_serve_message = lambda do | trans, state, &blk |
17
+ begin
18
+ $stderr.puts "### Before message #{trans.message_count.inspect}"
19
+ blk.call
20
+ ensure
21
+ $stderr.puts "### After message #{trans.message_count.inspect}"
22
+ end
23
+ end
16
24
  t.prepare_server!
17
25
  t.run_server!
18
26
  end
@@ -32,4 +40,6 @@ end
32
40
  # EXPECT: : server process
33
41
  # EXPECT: : Email.send_mail :pdf_invoice
34
42
  # EXPECT: : pr: :ok
43
+ # EXPECT: ### Before message nil
44
+ # EXPECT: ### After message 1
35
45
 
@@ -146,6 +146,8 @@ module ASIR
146
146
  state = message_ok = result = result_ok = nil
147
147
  exception = original_exception = unforwardable_exception = nil
148
148
  state = Message::State.new(:in_stream => in_stream, :out_stream => out_stream)
149
+ around_serve_message!(state) do
150
+ begin
149
151
  if receive_message(state)
150
152
  message_ok = true
151
153
  invoke_message!(state)
@@ -181,10 +183,27 @@ module ASIR
181
183
  @on_exception.call(self, exc, :result, state) if @on_exception
182
184
  end
183
185
  raise original_exception if unforwardable_exception
186
+
187
+ end # begin
188
+ end # around_serve_message!
184
189
  end
185
190
 
186
191
  # !SLIDE pause
187
192
 
193
+ def around_serve_message! state, &blk
194
+ if @around_serve_message
195
+ @around_serve_message.call(self, state, &blk)
196
+ else
197
+ yield
198
+ end
199
+ end
200
+
201
+ # A Proc to call around #serve_message!.
202
+ # trans.around_serve_message(trans, state)
203
+ # Should yield and return yield result.
204
+ # May be used to setup/teardown global resources during Message processing.
205
+ attr_accessor :around_serve_message
206
+
188
207
  # !SLIDE
189
208
  # Transport Server Support
190
209
  attr_accessor :running
@@ -1,3 +1,3 @@
1
1
  module ASIR
2
- VERSION = "1.2.9"
2
+ VERSION = "1.2.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asir
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.2.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -273,7 +273,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
273
273
  version: '0'
274
274
  segments:
275
275
  - 0
276
- hash: -2116348420781161108
276
+ hash: 2998837259913580415
277
277
  required_rubygems_version: !ruby/object:Gem::Requirement
278
278
  none: false
279
279
  requirements:
@@ -282,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
282
  version: '0'
283
283
  segments:
284
284
  - 0
285
- hash: -2116348420781161108
285
+ hash: 2998837259913580415
286
286
  requirements: []
287
287
  rubyforge_project:
288
288
  rubygems_version: 1.8.25