method_lister 0.3.2
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.markdown +208 -0
- data/lib/method_lister/color_display.rb +77 -0
- data/lib/method_lister/find_result.rb +50 -0
- data/lib/method_lister/finder.rb +113 -0
- data/lib/method_lister/ruby_ext.rb +24 -0
- data/lib/method_lister/simple_display.rb +55 -0
- data/lib/method_lister.rb +7 -0
- data/spec/color_display_spec.rb +37 -0
- data/spec/find_result_spec.rb +161 -0
- data/spec/finder_spec.rb +146 -0
- data/spec/helpers/matchers/list_methods.rb +42 -0
- data/spec/helpers/object_mother/find_result.rb +3 -0
- data/spec/helpers/object_mother/find_scenario.rb +45 -0
- data/spec/rcov.opts +6 -0
- data/spec/ruby_ext_spec.rb +55 -0
- data/spec/scenarios/class_with_inheritance.rb +17 -0
- data/spec/scenarios/class_with_inheritance_and_modules.rb +25 -0
- data/spec/scenarios/eigenclass.rb +18 -0
- data/spec/scenarios/eigenclass_with_modules.rb +26 -0
- data/spec/scenarios/filters_results_without_methods.rb +20 -0
- data/spec/scenarios/mixed_visibility_methods.rb +39 -0
- data/spec/scenarios/object_without_eigenclass.rb +4 -0
- data/spec/scenarios/overloaded_methods.rb +35 -0
- data/spec/scenarios/overloaded_methods_with_modules_mixed_in.rb +26 -0
- data/spec/scenarios/private_methods.rb +14 -0
- data/spec/scenarios/single_class.rb +11 -0
- data/spec/scenarios/single_class_with_module_mixed_in.rb +19 -0
- data/spec/simple_display_spec.rb +38 -0
- data/spec/spec.opts +7 -0
- data/spec/spec_helper.rb +14 -0
- metadata +100 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
module FindScenarioNameSpace
|
2
|
+
module MyModule
|
3
|
+
def method_in_module
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
class Klass
|
8
|
+
include MyModule
|
9
|
+
|
10
|
+
def method_in_class
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
@object = Klass.new
|
15
|
+
@expected = [
|
16
|
+
result(Klass, :public => ["method_in_class"]),
|
17
|
+
result(MyModule, :public => ["method_in_module"])
|
18
|
+
]
|
19
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
2
|
+
|
3
|
+
describe MethodLister::SimpleDisplay do
|
4
|
+
describe "#display" do
|
5
|
+
before do
|
6
|
+
@results = [
|
7
|
+
result(Object.new, :public => ["foo"], :private => ["secret"]),
|
8
|
+
result(Array, :private => ["secret"]),
|
9
|
+
result(Object, :public => ["bar"]),
|
10
|
+
result(Kernel, :public => ["baz"]),
|
11
|
+
]
|
12
|
+
|
13
|
+
@displayer = MethodLister::SimpleDisplay.new
|
14
|
+
|
15
|
+
@output = ""
|
16
|
+
stub(@displayer).puts do |*args|
|
17
|
+
@output += args.map {|arg| arg.to_s}.join("") + "\n"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it "attempts to write out the relevant information" do
|
22
|
+
@displayer.display @results
|
23
|
+
@output.should =~ /Module Kernel.*baz.*Class Object.*bar.*Eigenclass.*foo/m
|
24
|
+
end
|
25
|
+
|
26
|
+
it "does show private methods by default" do
|
27
|
+
@displayer.display @results
|
28
|
+
@output.should =~ /PRIVATE/
|
29
|
+
@output.should =~ /Class Array/
|
30
|
+
end
|
31
|
+
|
32
|
+
it "shows only public methods if told to" do
|
33
|
+
@displayer.display @results, true
|
34
|
+
@output.should_not =~ /PRIVATE/
|
35
|
+
@output.should_not =~ /Class Array/
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems' rescue nil
|
2
|
+
require 'spec'
|
3
|
+
|
4
|
+
SPEC_DIR = File.dirname(__FILE__)
|
5
|
+
|
6
|
+
require File.expand_path("#{SPEC_DIR}/../lib/method_lister")
|
7
|
+
Dir["#{SPEC_DIR}/helpers/**/*.rb"].each do |file|
|
8
|
+
require file
|
9
|
+
end
|
10
|
+
|
11
|
+
Spec::Runner.configure do |config|
|
12
|
+
config.mock_with :rr
|
13
|
+
config.include MethodListerMatchers
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: method_lister
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Matthew O'Connor
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-07-12 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description:
|
23
|
+
email: matthew @nospam@ canonical.org
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- README.markdown
|
30
|
+
files:
|
31
|
+
- lib/method_lister/color_display.rb
|
32
|
+
- lib/method_lister/find_result.rb
|
33
|
+
- lib/method_lister/finder.rb
|
34
|
+
- lib/method_lister/ruby_ext.rb
|
35
|
+
- lib/method_lister/simple_display.rb
|
36
|
+
- lib/method_lister.rb
|
37
|
+
- spec/color_display_spec.rb
|
38
|
+
- spec/find_result_spec.rb
|
39
|
+
- spec/finder_spec.rb
|
40
|
+
- spec/helpers/matchers/list_methods.rb
|
41
|
+
- spec/helpers/object_mother/find_result.rb
|
42
|
+
- spec/helpers/object_mother/find_scenario.rb
|
43
|
+
- spec/rcov.opts
|
44
|
+
- spec/ruby_ext_spec.rb
|
45
|
+
- spec/scenarios/class_with_inheritance.rb
|
46
|
+
- spec/scenarios/class_with_inheritance_and_modules.rb
|
47
|
+
- spec/scenarios/eigenclass.rb
|
48
|
+
- spec/scenarios/eigenclass_with_modules.rb
|
49
|
+
- spec/scenarios/filters_results_without_methods.rb
|
50
|
+
- spec/scenarios/mixed_visibility_methods.rb
|
51
|
+
- spec/scenarios/object_without_eigenclass.rb
|
52
|
+
- spec/scenarios/overloaded_methods.rb
|
53
|
+
- spec/scenarios/overloaded_methods_with_modules_mixed_in.rb
|
54
|
+
- spec/scenarios/private_methods.rb
|
55
|
+
- spec/scenarios/single_class.rb
|
56
|
+
- spec/scenarios/single_class_with_module_mixed_in.rb
|
57
|
+
- spec/simple_display_spec.rb
|
58
|
+
- spec/spec.opts
|
59
|
+
- spec/spec_helper.rb
|
60
|
+
- README.markdown
|
61
|
+
has_rdoc: true
|
62
|
+
homepage: http://github.com/matthew/method_lister/tree/master
|
63
|
+
licenses: []
|
64
|
+
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
version: "0"
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
requirements: []
|
89
|
+
|
90
|
+
rubyforge_project: method_lister
|
91
|
+
rubygems_version: 1.3.7
|
92
|
+
signing_key:
|
93
|
+
specification_version: 3
|
94
|
+
summary: Pretty method listers and finders, for use in IRB.
|
95
|
+
test_files:
|
96
|
+
- spec/color_display_spec.rb
|
97
|
+
- spec/find_result_spec.rb
|
98
|
+
- spec/finder_spec.rb
|
99
|
+
- spec/ruby_ext_spec.rb
|
100
|
+
- spec/simple_display_spec.rb
|