ri_for 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +38 -26
- data/Rakefile +3 -3
- data/VERSION +1 -1
- metadata +6 -6
data/README
CHANGED
@@ -1,32 +1,11 @@
|
|
1
|
-
|
1
|
+
The ri_for gem allows "runtime documentation lookup", it show a method's source code/comments, ri (if available), arity, parameters,
|
2
|
+
etc. all at runtime (for example within an irb session).
|
2
3
|
|
3
|
-
|
4
|
-
It
|
4
|
+
Don't know what a method does? Look it up!
|
5
|
+
It has proven quite useful, and I wouldn't do a ruby-debug session without it--you might like it.
|
5
6
|
|
6
7
|
Examples:
|
7
8
|
|
8
|
-
given this class
|
9
|
-
|
10
|
-
>> class A;
|
11
|
-
def go(a); end;
|
12
|
-
end
|
13
|
-
|
14
|
-
>> A.new.ri_for :go
|
15
|
-
sig: A#go arity 1
|
16
|
-
def go(a)
|
17
|
-
# do nothing
|
18
|
-
end
|
19
|
-
Parameters: go(a)
|
20
|
-
Searching ri for
|
21
|
-
sig: A#go arity 1
|
22
|
-
...
|
23
|
-
Nothing known about A
|
24
|
-
(end ri)
|
25
|
-
=> "Parameters: go(a)"
|
26
|
-
|
27
|
-
It has proven quite useful, and I wouldn't do a ruby-debug session without it--try it--you might like it.
|
28
|
-
|
29
|
-
more examples:
|
30
9
|
|
31
10
|
>> File.ri_for :delete
|
32
11
|
|
@@ -46,10 +25,31 @@ sig: File.delete arity -1
|
|
46
25
|
(end ri)
|
47
26
|
=> "sig: File.delete arity -1"
|
48
27
|
|
28
|
+
(or alternatively use >> File.method(:delete).ri_for)
|
29
|
+
|
30
|
+
or, given this dynamically generated class, it can still show runtime parameter information:
|
31
|
+
|
32
|
+
>> class A;
|
33
|
+
def go(a); end;
|
34
|
+
end
|
35
|
+
|
36
|
+
>> A.new.ri_for :go
|
37
|
+
|
38
|
+
sig: A#go arity 1
|
39
|
+
def go(a)
|
40
|
+
# do nothing
|
41
|
+
end
|
42
|
+
Parameters: go(a)
|
43
|
+
Searching ri for
|
44
|
+
sig: A#go arity 1
|
45
|
+
...
|
46
|
+
Nothing known about A
|
47
|
+
(end ri)
|
48
|
+
=> "Parameters: go(a)"
|
49
49
|
|
50
50
|
Or (my favorite) use it within debug session:
|
51
51
|
|
52
|
-
74 assert(
|
52
|
+
74 assert(true == false)
|
53
53
|
|
54
54
|
(rdb:1) ri_for :assert
|
55
55
|
#<Method: StoreControllerTest(Test::Unit::Assertions)#assert> arity: -2
|
@@ -106,6 +106,18 @@ Object#methods2 (like #methods, but inserts a marker after my_methods are shown)
|
|
106
106
|
|
107
107
|
This gem wraps for convenience the functionality of Method#source_location, ruby2ruby, et al, and was inspired by a snippet from manvenu, SourceRef (MBARI), and Python's Method#desc. It also wouldn't be useful without irb and the ruby-debug folks. Thanks!
|
108
108
|
|
109
|
+
=== Related ===
|
110
|
+
|
111
|
+
https://github.com/dadooda/ori (just lists ri, not method bodies and parameters, like mine does).
|
112
|
+
also irb has a "help" command for obtaining (just lists ri) but it's pretty obscure nobody knows about it.
|
113
|
+
>> help "Array"
|
114
|
+
>> help "Array#[]" (just displays ri)
|
115
|
+
|
116
|
+
There are quite a few "#methods" helper utilties out there, too.
|
117
|
+
irbtools also lists a lot of other irb helpers.
|
118
|
+
|
119
|
+
=== Feedback ===
|
120
|
+
|
109
121
|
Comments/suggestions welcome rogerdpack on gmail or rdp on github
|
110
122
|
|
111
123
|
github.com/rdp/ri_for
|
data/Rakefile
CHANGED
@@ -2,10 +2,10 @@ require 'jeweler'
|
|
2
2
|
Jeweler::Tasks.new do |s|
|
3
3
|
s.name = %q{ri_for}
|
4
4
|
s.authors = ["Roger Pack"]
|
5
|
-
s.description = s.summary = %q{ruby method describer to make it possible to inspect methods [rdoc, signature, etc.] at runtime, for example while debugging.}
|
5
|
+
s.description = s.summary = %q{ruby method describer to make it possible to inspect methods [rdoc, signature, etc.] at runtime, for example while debugging or in irb.}
|
6
6
|
s.email = ["rogerdpack@gmail.comm"]
|
7
|
-
s.homepage = %q{http://github.com/
|
8
|
-
s.add_dependency(%q<rdoc>, [">= 2.3"]) # for quick ri lookup times
|
7
|
+
s.homepage = %q{http://github.com/rdp/ri_for}
|
8
|
+
s.add_dependency(%q<rdoc>, [">= 2.3"]) # higher version for quick ri lookup times
|
9
9
|
s.add_dependency(%q<rdp-arguments>, [">= 0.6.4"])
|
10
10
|
s.add_dependency(%q<ParseTree>) # these next two for 1.8 only...
|
11
11
|
s.add_dependency(%q<ruby2ruby>)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ri_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Roger Pack
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2012-01-04 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rdoc
|
@@ -89,7 +89,7 @@ dependencies:
|
|
89
89
|
version: "0"
|
90
90
|
type: :development
|
91
91
|
version_requirements: *id007
|
92
|
-
description: ruby method describer to make it possible to inspect methods [rdoc, signature, etc.] at runtime, for example while debugging.
|
92
|
+
description: ruby method describer to make it possible to inspect methods [rdoc, signature, etc.] at runtime, for example while debugging or in irb.
|
93
93
|
email:
|
94
94
|
- rogerdpack@gmail.comm
|
95
95
|
executables: []
|
@@ -115,7 +115,7 @@ files:
|
|
115
115
|
- test/test_ri_rb_used_internally
|
116
116
|
- todo
|
117
117
|
- TODO
|
118
|
-
homepage: http://github.com/
|
118
|
+
homepage: http://github.com/rdp/ri_for
|
119
119
|
licenses: []
|
120
120
|
|
121
121
|
post_install_message:
|
@@ -138,9 +138,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
requirements: []
|
139
139
|
|
140
140
|
rubyforge_project:
|
141
|
-
rubygems_version: 1.8.
|
141
|
+
rubygems_version: 1.8.13
|
142
142
|
signing_key:
|
143
143
|
specification_version: 3
|
144
|
-
summary: ruby method describer to make it possible to inspect methods [rdoc, signature, etc.] at runtime, for example while debugging.
|
144
|
+
summary: ruby method describer to make it possible to inspect methods [rdoc, signature, etc.] at runtime, for example while debugging or in irb.
|
145
145
|
test_files: []
|
146
146
|
|