desc_method 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/method_describer/method_desc.rb +14 -8
- metadata +2 -2
@@ -65,12 +65,13 @@ module SourceLocationDesc
|
|
65
65
|
# pull out names for 1.8
|
66
66
|
begin
|
67
67
|
klass = eval(class_name)
|
68
|
-
# we don't call to_ruby to overcome ruby2ruby
|
68
|
+
# we don't call to_ruby to overcome ruby2ruby bugs... http://rubyforge.org/tracker/index.php?func=detail&aid=26891&group_id=1513&atid=5921
|
69
69
|
if joiner == '#'
|
70
|
-
|
70
|
+
code = RubyToRuby.new.process(ParseTree.translate(klass, method_name))
|
71
71
|
else
|
72
|
-
|
72
|
+
code = RubyToRuby.new.process(ParseTree.translate(klass.singleton_class, method_name))
|
73
73
|
end
|
74
|
+
doc << code
|
74
75
|
args = Arguments.names( klass, method_name) rescue Arguments.names(klass.singleton_class, method_name)
|
75
76
|
out = []
|
76
77
|
args.each{|arg_pair|
|
@@ -82,8 +83,8 @@ module SourceLocationDesc
|
|
82
83
|
param_string = "Parameters: #{method_name}(" + out + ")"
|
83
84
|
doc << param_string unless want_the_description_returned
|
84
85
|
rescue Exception => e
|
85
|
-
|
86
86
|
puts "fail to parse tree: #{class_name} #{e} #{e.backtrace}" if $VERBOSE
|
87
|
+
doc << ParseTree.translate(klass, method_name)
|
87
88
|
end
|
88
89
|
else
|
89
90
|
# 1.9.x
|
@@ -133,7 +134,7 @@ module SourceLocationDesc
|
|
133
134
|
RDoc::RI::Driver.run [full_name, '--no-pager'] unless want_just_summary
|
134
135
|
rescue *[StandardError, SystemExit]
|
135
136
|
# not found
|
136
|
-
|
137
|
+
ensure
|
137
138
|
puts '(end ri)'
|
138
139
|
end unless already_got_ri
|
139
140
|
|
@@ -151,20 +152,25 @@ end
|
|
151
152
|
class Method; include SourceLocationDesc; end
|
152
153
|
class UnboundMethod; include SourceLocationDesc; end
|
153
154
|
|
154
|
-
#
|
155
|
+
# LTODO mixin from a separate module
|
155
156
|
class Object
|
156
157
|
# currently rather verbose, but will attempt to describe all it knows about a method
|
157
158
|
def desc_method name, options = {}
|
158
159
|
if self.is_a? Class
|
159
160
|
# i.e. String.strip
|
160
|
-
|
161
|
+
begin
|
162
|
+
instance_method(name).desc(options)
|
163
|
+
rescue => e
|
164
|
+
# allow for Class.instance_method_name
|
165
|
+
method(name).desc(options)
|
166
|
+
end
|
161
167
|
else
|
162
168
|
method(name).desc(options)
|
163
169
|
end
|
164
170
|
end
|
171
|
+
alias :desc :desc_method
|
165
172
|
end
|
166
173
|
|
167
|
-
|
168
174
|
=begin
|
169
175
|
doctest:
|
170
176
|
>> require 'pathname'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: desc_method
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roger Pack
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-12 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|