WireAPI 0.3 → 0.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/amq_connection.c CHANGED
@@ -43,7 +43,13 @@ static VALUE con_client_session_new(VALUE self)
43
43
  rb_raise(rb_eRuntimeError,"Could not connect to server");
44
44
  }
45
45
 
46
- return(rb_session);
46
+ if (rb_block_given_p()) {
47
+ rb_yield(rb_session);
48
+ ses_client_session_destroy(rb_session);
49
+ return Qtrue;
50
+ } else {
51
+ return rb_session ;
52
+ }
47
53
  }
48
54
 
49
55
 
@@ -52,7 +58,7 @@ static VALUE con_client_session_new(VALUE self)
52
58
  * AMQ_Connection#destroy -> nil
53
59
  *
54
60
  */
55
- static VALUE con_client_connection_destroy(VALUE self)
61
+ VALUE con_client_connection_destroy(VALUE self)
56
62
  {
57
63
  amq_connection_cls *const connection_obj=get_amq_connection_cls(self,0);
58
64
  if (connection_obj && connection_obj->connection) {
data/amq_connection.h CHANGED
@@ -1,5 +1,9 @@
1
1
  #ifndef AMQ_CONNECTION_HEADER
2
2
  #define AMQ_CONNECTION_HEADER
3
+
4
+ #include<ruby.h>
5
+
3
6
  void init_connection();
7
+ VALUE con_client_connection_destroy(VALUE self);
4
8
 
5
9
  #endif
data/amq_content.c CHANGED
@@ -162,7 +162,7 @@ static VALUE cont_content_basic_set_expiration(VALUE self,VALUE expiration)
162
162
  static VALUE cont_content_basic_get_delivery_mode_persistent(VALUE self)
163
163
  {
164
164
  amq_content_cls* const content_obj=get_amq_content_cls(self,1);
165
- if (amq_content_basic_get_deliverymode(content_obj->content)==2)
165
+ if (amq_content_basic_get_delivery_mode(content_obj->content)==2)
166
166
  return Qtrue;
167
167
  else
168
168
  return Qfalse;
data/amq_session.c CHANGED
@@ -83,7 +83,7 @@ static VALUE ses_error_text(VALUE self)
83
83
  * After calling this method the session object will become unusable since the
84
84
  * internal structures will be released
85
85
  */
86
- static VALUE ses_client_session_destroy(VALUE self)
86
+ VALUE ses_client_session_destroy(VALUE self)
87
87
  {
88
88
  amq_session_cls *const session_obj=get_amq_session_cls(self,0);
89
89
  if (session_obj && session_obj->session) {
data/amq_session.h CHANGED
@@ -1,5 +1,9 @@
1
1
  #ifndef AMQ_SESSION_HEADER
2
2
  #define AMQ_SESSION_HEADER
3
3
 
4
+ #include <ruby.h>
5
+
4
6
  void init_session();
7
+ VALUE ses_client_session_destroy(VALUE self);
8
+
5
9
  #endif
data/amq_wireapi.c CHANGED
@@ -158,7 +158,12 @@ static VALUE rbWireAPI_client_connection_new(VALUE self,
158
158
  rb_raise(rb_amq_error,"Could not connect to server");
159
159
 
160
160
  rb_connection = create_amq_connection_cls(connection);
161
- return (rb_connection);
161
+ if (rb_block_given_p()) {
162
+ rb_yield(rb_connection);
163
+ con_client_connection_destroy(rb_connection);
164
+ return Qtrue;
165
+ }
166
+ return rb_connection;
162
167
  }
163
168
 
164
169
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: WireAPI
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.3"
4
+ version: "0.4"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurgen Van Ham
@@ -9,12 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-04 00:00:00 +02:00
12
+ date: 2009-05-05 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
16
  description:
17
- email: jvh@vasco.com
17
+ email: juvanham@rubyforge.org
18
18
  executables: []
19
19
 
20
20
  extensions: