cutter 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +54 -10
- data/lib/cutter/railtie.rb +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -15,9 +15,10 @@ Insert #inspect! method into any of your methods:
|
|
15
15
|
end
|
16
16
|
|
17
17
|
your_method(1,"foo",:bar) =>
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
|
19
|
+
method `your_method'
|
20
|
+
variables:
|
21
|
+
args: [1, "foo", :bar]
|
21
22
|
|
22
23
|
or in more rigorous way:
|
23
24
|
|
@@ -26,22 +27,65 @@ or in more rigorous way:
|
|
26
27
|
end
|
27
28
|
|
28
29
|
your_another_method(1,"foo",:bar) =>
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
|
31
|
+
method `your_another_method'
|
32
|
+
variables:
|
33
|
+
first: 1
|
34
|
+
second: "foo"
|
35
|
+
third: :bar
|
36
|
+
block:
|
35
37
|
|
36
38
|
|
37
39
|
Gives simple but nice trace for inspection: method's name and args that were passed to method
|
38
40
|
|
41
|
+
With :inspect => true we have self#inspect of class to which method belongs to:
|
42
|
+
|
43
|
+
def method_self_inspect
|
44
|
+
...
|
45
|
+
inspect!(:inspect => true) {}
|
46
|
+
end
|
47
|
+
|
48
|
+
method_self_inspect(1,2,3,4,5) =>
|
49
|
+
|
50
|
+
method: `method_self_inspect'
|
51
|
+
called from class: SelfInspectDemo
|
52
|
+
variables:
|
53
|
+
name: 1
|
54
|
+
args: [2, 3, 4, 5]
|
55
|
+
block:
|
56
|
+
self inspection:
|
57
|
+
#<SelfInspectDemo:0x82be488 @variable="I'm variable">
|
58
|
+
|
59
|
+
And finally :level => N gives caller methods chain (N + 1 caller methods):
|
60
|
+
|
61
|
+
def method_caller_chain
|
62
|
+
...
|
63
|
+
inspect!(:level => 2)
|
64
|
+
end
|
65
|
+
|
66
|
+
method_caller_chain(1,2,3,4,5) =>
|
67
|
+
|
68
|
+
method: `method_caller_chain'
|
69
|
+
called from class: RSpec::Core::ExampleGroup::Nested_1::Nested_1
|
70
|
+
variables:
|
71
|
+
name: 1
|
72
|
+
args: [2, 3, 4, 5]
|
73
|
+
block:
|
74
|
+
caller methods:
|
75
|
+
/home/stanislaw/_work_/gems/cutter/spec/inspection/demo_spec.rb:33:in `method_caller_chain'
|
76
|
+
/home/stanislaw/_work_/gems/cutter/spec/inspection/demo_spec.rb:40:in `block (3 levels) in <top (required)>'
|
77
|
+
/home/stanislaw/.rvm/gems/ruby-1.9.2-p180@310/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `instance_eval'
|
78
|
+
|
39
79
|
If you want all #inspect! methods fall silent at once, use
|
40
80
|
Cutter::Inspection.quiet!
|
41
81
|
To make them sound again do
|
42
82
|
Cutter::Inspection.loud!
|
43
83
|
|
44
|
-
You can clone it and try
|
84
|
+
You can clone it and try
|
85
|
+
|
86
|
+
bundle exec rspec spec/inspection/demo_spec.rb
|
87
|
+
|
88
|
+
Very! Very simple!
|
45
89
|
|
46
90
|
==II) #stamper
|
47
91
|
def your_method
|
data/lib/cutter/railtie.rb
CHANGED
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.9
|
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-07-
|
13
|
+
date: 2011-07-23 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: 554901585
|
114
114
|
segments:
|
115
115
|
- 0
|
116
116
|
version: "0"
|