bindex 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a786a7432d70960e943a5114f81888e4ae66a856
4
- data.tar.gz: 62378c2b62cf68d181882727ca55d97cfd22e0f9
3
+ metadata.gz: ee2e50960f0fc636073a2d4a2597d169fae84bf2
4
+ data.tar.gz: d456453d22c61a8f19a6c8e1a73c149c7930a386
5
5
  SHA512:
6
- metadata.gz: 4b5d57034831194f380cbf8912b10560f9e5368cfec9e800b5c62069660c838f8209344a9a682eb277f80a5184b70d5271288b0c89f14745ee234c0d92287430
7
- data.tar.gz: 43f9c1b35db5f6d58ea66ce7d9152b450dbb7abf308a4988fefb41745cfccc3dccb570eb3355702ad19bb25d1cf6e0d07e9662a1a8fd9f626ae444898a6066c5
6
+ metadata.gz: 28100af5bd5b378da0a983d381c10f235ccfb98db38ad6513fa9ac5b793042f07c5755912fe8b1723c8b36438929a4b96aed02b64810fe5b6c6b4e2dda1ddd37
7
+ data.tar.gz: da0c772ab6d28e3d1edfe1b2284c86fbf2d7a3cbca0a2a3d782807268b97ef2c95bcdd0d0b4e9a208458b0e1be8a181db76aa9af2a66df88915d943ee00eea2e
@@ -16,6 +16,9 @@ public class SetExceptionBindingsEventHook extends EventHook {
16
16
  RubyArray bindings = RubyBindingsCollector.collectCurrentFor(context);
17
17
  RubyException exception = (RubyException) context.runtime.getGlobalVariables().get("$!");
18
18
 
19
- exception.setInstanceVariable("@bindings", bindings);
19
+ IRubyObject exceptionBindings = exception.getInstanceVariable("@bindings");
20
+ if (exceptionBindings == null || exceptionBindings.isNil()) {
21
+ exception.setInstanceVariable("@bindings", bindings);
22
+ }
20
23
  }
21
24
  }
@@ -2,6 +2,7 @@
2
2
  #include <ruby/debug.h>
3
3
 
4
4
  VALUE bx_mBindex;
5
+ static ID id_bindings;
5
6
 
6
7
  static VALUE
7
8
  current_bindings_callback(const rb_debug_inspector_t *context, void *data)
@@ -32,8 +33,13 @@ set_exception_bindings_callback(VALUE tpval, void *data)
32
33
  {
33
34
  rb_trace_arg_t *trace_arg = rb_tracearg_from_tracepoint(tpval);
34
35
  VALUE exception = rb_tracearg_raised_exception(trace_arg);
36
+ VALUE bindings = rb_attr_get(exception, id_bindings);
35
37
 
36
- rb_iv_set(exception, "bindings", current_bindings());
38
+ /* Set the bindings, only if they haven't been set already. This may reset
39
+ * the binding during reraise. */
40
+ if (NIL_P(bindings)) {
41
+ rb_ivar_set(exception, id_bindings, current_bindings());
42
+ }
37
43
  }
38
44
 
39
45
  void
@@ -52,9 +58,8 @@ bx_current_bindings(VALUE self)
52
58
  static VALUE
53
59
  bx_exc_bindings(VALUE self)
54
60
  {
55
- VALUE bindings;
61
+ VALUE bindings = rb_attr_get(self, id_bindings);
56
62
 
57
- bindings = rb_iv_get(self, "bindings");
58
63
  if (NIL_P(bindings)) {
59
64
  bindings = rb_ary_new();
60
65
  }
@@ -66,6 +71,7 @@ void
66
71
  Init_cruby(void)
67
72
  {
68
73
  bx_mBindex = rb_define_module("Bindex");
74
+ id_bindings = rb_intern("bindings");
69
75
 
70
76
  rb_define_singleton_method(bx_mBindex, "current_bindings", bx_current_bindings, 0);
71
77
  rb_define_method(rb_eException, "bindings", bx_exc_bindings, 0);
@@ -1,3 +1,3 @@
1
1
  module Bindex
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,72 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bindex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genadi Samokovarov
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-18 00:00:00.000000000 Z
11
+ date: 2017-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ name: minitest
14
15
  requirement: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - "~>"
17
18
  - !ruby/object:Gem::Version
18
19
  version: '5.4'
19
- name: minitest
20
- prerelease: false
21
20
  type: :development
21
+ prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5.4'
27
27
  - !ruby/object:Gem::Dependency
28
+ name: bundler
28
29
  requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ">="
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
- name: bundler
34
- prerelease: false
35
34
  type: :development
35
+ prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
+ name: rake
42
43
  requirement: !ruby/object:Gem::Requirement
43
44
  requirements:
44
45
  - - ">="
45
46
  - !ruby/object:Gem::Version
46
47
  version: '0'
47
- name: rake
48
- prerelease: false
49
48
  type: :development
49
+ prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
+ name: rake-compiler
56
57
  requirement: !ruby/object:Gem::Requirement
57
58
  requirements:
58
59
  - - ">="
59
60
  - !ruby/object:Gem::Version
60
61
  version: '0'
61
- name: rake-compiler
62
- prerelease: false
63
62
  type: :development
63
+ prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description:
69
+ description:
70
70
  email:
71
71
  - gsamokovarov@gmail.com
72
72
  executables: []
@@ -109,7 +109,7 @@ homepage: https://github.com/gsamokovarov/bindex
109
109
  licenses:
110
110
  - MIT
111
111
  metadata: {}
112
- post_install_message:
112
+ post_install_message:
113
113
  rdoc_options: []
114
114
  require_paths:
115
115
  - lib
@@ -124,9 +124,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  requirements: []
127
- rubyforge_project:
127
+ rubyforge_project:
128
128
  rubygems_version: 2.6.8
129
- signing_key:
129
+ signing_key:
130
130
  specification_version: 4
131
131
  summary: Bindings for your Ruby exceptions
132
132
  test_files: