cutter 0.5.11 → 0.5.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cutter/inspection.rb +27 -3
- metadata +3 -3
data/lib/cutter/inspection.rb
CHANGED
@@ -31,24 +31,37 @@ class Object
|
|
31
31
|
|
32
32
|
# Want caller methods chain to be traced? - pass option :level to inspect!
|
33
33
|
options = options.extract_options!
|
34
|
+
|
35
|
+
max = options[:max]
|
36
|
+
options.maximize_options! if max
|
37
|
+
|
34
38
|
level = options[:level]
|
35
39
|
_caller = caller
|
36
40
|
|
37
41
|
self_inspection = eval('self.inspect', _binding) if options[:inspect]
|
42
|
+
|
38
43
|
# Basic info
|
39
|
-
puts %|\nmethod: `#{eval('__method__', _binding)}'|
|
44
|
+
puts %|\nmethod: `#{eval('__method__', _binding)}' #{'(maximal tracing)' if max}|
|
40
45
|
puts %| called from class: #{eval('self.class', _binding)}|
|
41
46
|
|
42
47
|
lvb = eval('local_variables',_binding)
|
43
48
|
puts %| local_variables: #{"[]" if lvb.empty?}|
|
49
|
+
|
44
50
|
lvb.map do |lv|
|
45
|
-
|
51
|
+
local_variable = eval(lv.to_s, _binding)
|
52
|
+
local_variable = (max ? local_variable.inspect : local_variable.to_real_string)
|
53
|
+
|
54
|
+
puts %| #{lv}: #{local_variable}|
|
46
55
|
end if lvb
|
47
56
|
|
48
57
|
ivb = eval('instance_variables',_binding)
|
49
58
|
puts %| instance_variables: #{"[]" if ivb.empty?}|
|
59
|
+
|
50
60
|
ivb.map do |lv|
|
51
|
-
|
61
|
+
instance_variable = eval(lv.to_s, _binding)
|
62
|
+
instance_variable = (max ? instance_variable.inspect : instance_variable.to_real_string)
|
63
|
+
|
64
|
+
puts %| #{lv}: #{instance_variable}|
|
52
65
|
end if ivb
|
53
66
|
|
54
67
|
# Self inspection
|
@@ -74,4 +87,15 @@ class Object
|
|
74
87
|
caller[level][/`([^']*)'/,1].to_sym
|
75
88
|
end
|
76
89
|
|
90
|
+
protected
|
91
|
+
|
92
|
+
def maximize_options!
|
93
|
+
self.merge!({:max => true, :inspect => true, :level => 2})
|
94
|
+
end
|
95
|
+
|
96
|
+
def to_real_string
|
97
|
+
return ":#{self.to_s}" if self.class == Symbol
|
98
|
+
self
|
99
|
+
end
|
77
100
|
end
|
101
|
+
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cutter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.12
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- stanislaw
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-03 00:00:00 +03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
110
|
requirements:
|
111
111
|
- - ">="
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
hash:
|
113
|
+
hash: 800129939
|
114
114
|
segments:
|
115
115
|
- 0
|
116
116
|
version: "0"
|