1
- module WebConsole
2
- # Returns the Ruby bindings of Kernel#callers locations.
3
- #
4
- # The list of bindings here doesn't map 1 to 1 with Kernel#callers, as we
5
- # can't build Ruby bindings for C functions or the equivalent native
6
- # implementations in JRuby and Rubinius.
7
- #
8
- # This method needs to be overridden by every integration.
9
- def self . caller_bindings
10
- raise NotImplementedError
11
- end
12
- end
13
-
14
1
class Exception
15
2
# Returns an array of the exception backtrace locations bindings.
16
3
#
17
4
# The list won't map to the traces in #backtrace 1 to 1, because we can't
18
5
# build bindings for every trace (C functions, for example).
19
6
#
20
- # Every integration should the instance variable.
7
+ # Every integration should set the instance variable.
21
8
def bindings
22
- ( defined? ( @bindings ) && @bindings ) || [ ]
9
+ defined? ( @bindings ) ? @bindings : [ ]
23
10
end
24
11
end
25
12
@@ -28,4 +15,19 @@ def bindings
28
15
require 'web_console/integration/rubinius'
29
16
when 'ruby'
30
17
require 'web_console/integration/cruby'
18
+ else
19
+ # Prevent a `method redefined; discarding old caller_bindings` warning.
20
+
21
+ module WebConsole
22
+ # Returns the Ruby bindings of Kernel#callers locations.
23
+ #
24
+ # The list of bindings here doesn't map 1 to 1 with Kernel#callers, as we
25
+ # can't build Ruby bindings for C functions or the equivalent native
26
+ # implementations in JRuby and Rubinius.
27
+ #
28
+ # This method needs to be overridden by every integration.
29
+ def self . caller_bindings
30
+ raise NotImplementedError
31
+ end
32
+ end
31
33
end
0 commit comments