methodmissing-callback 1.0.0 → 1.0.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/callback.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "callback"
3
- s.version = "1.0.0"
3
+ s.version = "1.0.1"
4
4
  s.date = "2009-08-22"
5
5
  s.summary = "Native MRI callback"
6
6
  s.email = "lourens@methodmissing.com"
@@ -17,7 +17,6 @@ Gem::Specification.new do |s|
17
17
  bench/raggi_bench.rb
18
18
  ext/callback/extconf.rb
19
19
  ext/callback/callback.c
20
- lib/callback.rb
21
20
  callback.gemspec
22
21
  ] + Dir.glob('test/*')
23
22
  s.rdoc_options = ["--main", "README"]
@@ -1,5 +1,9 @@
1
1
  #include "ruby.h"
2
2
 
3
+ #ifndef RSTRING_PTR
4
+ #define RSTRING_PTR(obj) RSTRING(obj)->ptr
5
+ #endif
6
+
3
7
  typedef struct {
4
8
  VALUE object;
5
9
  ID method;
@@ -43,6 +47,7 @@ static VALUE rb_callback_initialize( int argc, VALUE *argv, VALUE cb )
43
47
  {
44
48
  VALUE object;
45
49
  VALUE method;
50
+ ID meth;
46
51
  RCallback* cbs = GetCallbackStruct(cb);
47
52
 
48
53
  if (rb_block_given_p()) {
@@ -52,7 +57,9 @@ static VALUE rb_callback_initialize( int argc, VALUE *argv, VALUE cb )
52
57
  }else {
53
58
  rb_scan_args(argc, argv, "02", &object, &method);
54
59
  cbs->object = object;
55
- cbs->method = rb_to_id(method);
60
+ meth = rb_to_id(method);
61
+ if (!rb_respond_to(object,meth)) rb_raise(rb_eArgError, "object does not respond to %s", RSTRING_PTR(rb_obj_as_string(method)));
62
+ cbs->method = meth;
56
63
  }
57
64
 
58
65
  OBJ_FREEZE(cb);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: methodmissing-callback
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Lourens Naud\xC3\xA9 (methodmissing)"
@@ -30,7 +30,6 @@ files:
30
30
  - bench/raggi_bench.rb
31
31
  - ext/callback/extconf.rb
32
32
  - ext/callback/callback.c
33
- - lib/callback.rb
34
33
  - callback.gemspec
35
34
  has_rdoc: true
36
35
  homepage: http://github.com/methodmissing/callback
data/lib/callback.rb DELETED
@@ -1 +0,0 @@
1
- # stubbed