jinyu-debug-tools 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/utils/method_debugger.rb +14 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04b28856f2f9ef3e5b61da97680c38fbf488406b
|
4
|
+
data.tar.gz: aadcf61df0c48701a89575e4cefe3f5280588aa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cabcae7d7efbf8ca7067eed783143ef8cc051b07db5959d08fd73782662661adaba505eb0f713e3e4670c3561af91231cfd739f42edbff6aba179fc2567a0717
|
7
|
+
data.tar.gz: c1eff24c9ae617bf7f86d632eeb79f925f5c35af54af29f2c00d9f48acd0fa368cd3bc7f32f70c44a90c6420b7ba2867bdc1672f54eefb96c6a8e478907d2f40
|
@@ -2,19 +2,27 @@ module JinyuDebugTools
|
|
2
2
|
module MethodDebugger
|
3
3
|
def self.included(sub_klass)
|
4
4
|
sub_klass.class_eval do
|
5
|
-
|
5
|
+
@@__debug_log = []
|
6
|
+
@@__method_table = Hash.new{|hash, key| hash[key] = {}}
|
6
7
|
|
7
8
|
def self.method_added(method_name)
|
8
|
-
return if
|
9
|
-
|
10
|
-
return if method_name.to_s.match(/^____/)
|
9
|
+
return if @@__method_table[self][method_name]
|
10
|
+
@@__method_table[self][method_name] = true
|
11
11
|
|
12
|
+
return if method_name.to_s.match(/^__/)
|
13
|
+
#p "alias_method #{self}.__#{method_name}, #{method_name}"
|
12
14
|
alias_method "__#{method_name}".to_sym, method_name
|
15
|
+
self_class = self
|
13
16
|
|
14
17
|
define_method(method_name) do |*method_args, &block|
|
15
18
|
caller_file = caller[0].split('/').last
|
16
|
-
puts "jinyu.debug: #{caller_file} calls #{method_name}, #{method_args.map(&:class)}"
|
17
|
-
|
19
|
+
puts "jinyu.debug: #{caller_file} calls #{method_name}, #{method_args.map(&:class)}"
|
20
|
+
|
21
|
+
# hit 'super' keyword issue, check with https://stackoverflow.com/questions/18448831
|
22
|
+
# remove line below
|
23
|
+
#self.send("__#{method_name}".to_sym, *method_args, &block)
|
24
|
+
|
25
|
+
self_class.instance_method("__#{method_name}".to_sym).bind(self).call(*method_args, &block)
|
18
26
|
end
|
19
27
|
end
|
20
28
|
end
|