ri_for 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,9 +7,8 @@ Jeweler::Tasks.new do |s|
7
7
 
8
8
  s.homepage = %q{http://github.com/rogerdpack/method_describer}
9
9
  s.add_dependency(%q<rdoc>, [">= 2.3"]) # for sane ri lookup times
10
- s.add_dependency(%q<rdp-require_all>, [">= 1.1.0.1"]) # require_rel
11
10
  s.add_dependency(%q<rdp-arguments>, [">= 0.6.4"])
12
- s.add_dependency(%q<sane>, ['>= 0.1.2'])
11
+ s.add_dependency(%q<sane>, ['>= 0.20.1'])
13
12
  s.add_dependency(%q<ParseTree>) # these next two for 1.8 only...
14
13
  s.add_dependency(%q<ruby2ruby>)
15
14
  s.add_development_dependency("rubydoctest")
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.4.0
@@ -1,4 +1,4 @@
1
- require_rel 'method_ri'
1
+ require_relative 'method_ri'
2
2
 
3
3
  class Class
4
4
  # just runs ri against the class, outputs a big
@@ -13,8 +13,9 @@ module Kernel
13
13
  end
14
14
  end
15
15
 
16
- if $0 == __FILE__
17
- class A; end
18
- puts 'A.methods', A.methods(true).inspect, A.methods(false).inspect
19
- puts 'A.new.methods', A.new.methods.inspect
20
- end
16
+ class Object
17
+ def my_methods(_super=false)
18
+ _methods = (_super) ? self.class.superclass.new.methods : Object.methods
19
+ (self.methods - _methods).sort
20
+ end
21
+ end
@@ -25,7 +25,7 @@ module SourceLocationDesc
25
25
  # or "#<Method: Order(id: integer, order_number: integer).get_cc_processor>"
26
26
  # or "#<Method: Order(id: integer, order_number: integer)(ActiveRecord::Base).get_cc_processor>"
27
27
 
28
- string = to_s
28
+ string = param_string = to_s
29
29
 
30
30
  # derive class_name
31
31
  parenthese_count = string.count '('
@@ -65,7 +65,7 @@ module SourceLocationDesc
65
65
  if !(respond_to? :source_location)
66
66
  # pull out names for 1.8
67
67
  begin
68
- klass = eval(class_name)
68
+ klass = eval(class_name)
69
69
  # we don't call to_ruby to overcome ruby2ruby bug http://rubyforge.org/tracker/index.php?func=detail&aid=26891&group_id=1513&atid=5921
70
70
  if joiner == '#'
71
71
  raw_code = ParseTree.new.parse_tree_for_method(klass, method_name)
@@ -80,7 +80,6 @@ module SourceLocationDesc
80
80
  out << arg_pair.join(' = ')
81
81
  } if args
82
82
  out = out.join(', ')
83
- param_string = out
84
83
  return out if want_just_summary
85
84
 
86
85
  param_string = "Parameters: #{method_name}(" + out + ")"
@@ -88,6 +87,7 @@ module SourceLocationDesc
88
87
  rescue Exception => e
89
88
  doc << "appears to be a c method"
90
89
  puts "fail to parse tree: #{class_name} #{e} #{e.backtrace}" if $VERBOSE
90
+ doc << "appears to be a c method"
91
91
  end
92
92
  else
93
93
  # 1.9.x
@@ -108,7 +108,7 @@ module SourceLocationDesc
108
108
  doc.unshift " at #{file}:#{line}"
109
109
 
110
110
  # now the real code will end with 'end' same whitespace as the first
111
- sig_white_space = sig.scan(/\W+/)[0]
111
+ sig_white_space = sig.scan(/^\W+/)[0] || ""
112
112
  body = all_lines[line..-1]
113
113
  body.each{|line|
114
114
  doc << line
data/lib/ri_for.rb CHANGED
@@ -1,2 +1,4 @@
1
1
  require 'sane'
2
- require_rel 'ri_for'
2
+ for file in Dir[__dir__ + '/ri_for/*'] do
3
+ require file
4
+ end
data/test/test_method.rb CHANGED
@@ -40,11 +40,18 @@ it should return you something useful
40
40
  >> A.ri_for(:go) == nil
41
41
  => false
42
42
 
43
- it should work with Module, too
44
-
43
+ it should work with Module
45
44
  >> FFI::Library.ri_for(:attach_function) == nil
46
45
  => false
47
46
 
47
+ it should say c method for c
48
+ >> output = String.ri_for(:strip, :want_the_description_returned => true).join(' ')
49
+ >> output.include?('c method')
50
+ => true
51
+ >> output = String.ri_for(:strip)
52
+ >> output.nil?
53
+ => false
54
+
48
55
  =end
49
56
 
50
57
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ri_for
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
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: 2010-01-02 00:00:00 -07:00
12
+ date: 2010-01-13 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,16 +22,6 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: "2.3"
24
24
  version:
25
- - !ruby/object:Gem::Dependency
26
- name: rdp-require_all
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.1.0.1
34
- version:
35
25
  - !ruby/object:Gem::Dependency
36
26
  name: rdp-arguments
37
27
  type: :runtime
@@ -50,7 +40,7 @@ dependencies:
50
40
  requirements:
51
41
  - - ">="
52
42
  - !ruby/object:Gem::Version
53
- version: 0.1.2
43
+ version: 0.20.1
54
44
  version:
55
45
  - !ruby/object:Gem::Dependency
56
46
  name: ParseTree