matthew-method_lister 0.3.0 → 0.3.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.markdown CHANGED
@@ -53,10 +53,23 @@ vary, depending on what you have loaded):
53
53
  require respond_to? send singleton_methods taint tainted? to_a to_s type
54
54
  untaint which
55
55
 
56
+ PRIVATE: Array Float Integer String URI ` abort at_exit autoload autoload?
57
+ binding block_given? callcc caller catch chomp chomp! chop chop! eval exec
58
+ exit exit! fail fork format gem_original_require getc gets
59
+ global_variables gsub gsub! initialize_copy iterator? lambda load
60
+ local_variables loop method_missing open p pp print printf proc putc puts
61
+ raise rand readline readlines remove_instance_variable scan select
62
+ set_trace_func singleton_method_added singleton_method_removed
63
+ singleton_method_undefined sleep split sprintf srand sub sub! syscall
64
+ system test throw trace_var trap untrace_var warn
65
+
56
66
  ========== Module PP::ObjectMixin ==========
57
67
  PUBLIC: pretty_print pretty_print_cycle pretty_print_inspect
58
68
  pretty_print_instance_variables
59
69
 
70
+ ========== Class Object ==========
71
+ PRIVATE: initialize irb_binding timeout
72
+
60
73
  ========== Module Enumerable ==========
61
74
  PUBLIC: all? any? collect detect each_with_index entries find find_all
62
75
  grep include? inject map max member? min partition reject select sort
@@ -71,7 +84,9 @@ vary, depending on what you have loaded):
71
84
  reverse! reverse_each rindex select shift size slice slice! sort sort!
72
85
  to_a to_ary to_s transpose uniq uniq! unshift values_at zip |
73
86
 
74
- You can show protected and private methods too by passing in "true":
87
+ PRIVATE: initialize initialize_copy
88
+
89
+ You can show only the public methods by passing in "true":
75
90
 
76
91
  >> [].ls true
77
92
  ========== Module Kernel ==========
@@ -83,23 +98,10 @@ You can show protected and private methods too by passing in "true":
83
98
  require respond_to? send singleton_methods taint tainted? to_a to_s type
84
99
  untaint which
85
100
 
86
- PRIVATE: Array Float Integer String URI ` abort at_exit autoload autoload?
87
- binding block_given? callcc caller catch chomp chomp! chop chop! eval exec
88
- exit exit! fail fork format gem_original_require getc gets
89
- global_variables gsub gsub! initialize_copy iterator? lambda load
90
- local_variables loop method_missing open p pp print printf proc putc puts
91
- raise rand readline readlines remove_instance_variable scan select
92
- set_trace_func singleton_method_added singleton_method_removed
93
- singleton_method_undefined sleep split sprintf srand sub sub! syscall
94
- system test throw trace_var trap untrace_var warn
95
-
96
101
  ========== Module PP::ObjectMixin ==========
97
102
  PUBLIC: pretty_print pretty_print_cycle pretty_print_inspect
98
103
  pretty_print_instance_variables
99
104
 
100
- ========== Class Object ==========
101
- PRIVATE: initialize irb_binding timeout
102
-
103
105
  ========== Module Enumerable ==========
104
106
  PUBLIC: all? any? collect detect each_with_index entries find find_all
105
107
  grep include? inject map max member? min partition reject select sort
@@ -114,8 +116,6 @@ You can show protected and private methods too by passing in "true":
114
116
  reverse! reverse_each rindex select shift size slice slice! sort sort!
115
117
  to_a to_ary to_s transpose uniq uniq! unshift values_at zip |
116
118
 
117
- PRIVATE: initialize initialize_copy
118
-
119
119
  `grep` or `mgrep`
120
120
  -----------------
121
121
 
@@ -127,28 +127,28 @@ objects `grep` is already taken:
127
127
  ========== Module Kernel ==========
128
128
  PUBLIC: freeze frozen? instance_of? instance_variable_defined? kind_of?
129
129
 
130
+ PRIVATE: fail fork format method_missing printf set_trace_func
131
+ singleton_method_undefined sprintf
132
+
130
133
  ========== Module Enumerable ==========
131
134
  PUBLIC: find find_all
132
135
 
133
136
  ========== Class Array ==========
134
137
  PUBLIC: delete_if fetch fill first flatten flatten! frozen? shift unshift
135
138
 
136
- Similar to `ls` you can pass in an extra argument of "true" to see protected
137
- and private methods:
139
+ Similar to `ls` you can pass in an extra argument of "true" to see only the
140
+ public methods:
138
141
 
139
142
  >> [].mgrep /f/, true
140
143
  ========== Module Kernel ==========
141
144
  PUBLIC: freeze frozen? instance_of? instance_variable_defined? kind_of?
142
145
 
143
- PRIVATE: fail fork format method_missing printf set_trace_func
144
- singleton_method_undefined sprintf
145
-
146
146
  ========== Module Enumerable ==========
147
147
  PUBLIC: find find_all
148
148
 
149
149
  ========== Class Array ==========
150
150
  PUBLIC: delete_if fetch fill first flatten flatten! frozen? shift unshift
151
-
151
+
152
152
  Note that `method_missing` is always considered a match, since it could always
153
153
  potentially execute.
154
154
 
@@ -170,12 +170,12 @@ method you're seeking. You can pass the method name in as a string or symbol.
170
170
 
171
171
  Logically the `which` command is the same as `grep(/^your_method$/)` and so
172
172
  the same comments apply about `method_missing` and the optional parameter to
173
- see protected/private methods.
173
+ see only public methods.
174
174
 
175
175
  License
176
176
  =======
177
177
 
178
- Copyright 2008, Matthew O'Connor All rights reserved.
178
+ Copyright 2008, 2009, Matthew O'Connor All rights reserved.
179
179
 
180
180
  This program is free software; you can redistribute it and/or modify it under
181
181
  the same terms as Ruby 1.8.7 itself.
@@ -1,24 +1,24 @@
1
1
  module Kernel
2
- def mls(show_non_public=false,
2
+ def mls(show_public_only=false,
3
3
  displayer=MethodLister::ColorDisplay.new,
4
4
  finder=MethodLister::Finder.new)
5
- displayer.display finder.ls(self), show_non_public
5
+ displayer.display finder.ls(self), show_public_only
6
6
  end
7
7
  alias :ls :mls
8
8
 
9
9
  def mgrep(regex,
10
- show_non_public=false,
10
+ show_public_only=false,
11
11
  displayer=MethodLister::ColorDisplay.new,
12
12
  finder=MethodLister::Finder.new)
13
- displayer.display finder.grep(regex, self), show_non_public
13
+ displayer.display finder.grep(regex, self), show_public_only
14
14
  end
15
15
  alias :grep :mgrep
16
16
 
17
17
  def mwhich(method,
18
- show_non_public=false,
18
+ show_public_only=false,
19
19
  displayer=MethodLister::ColorDisplay.new,
20
20
  finder=MethodLister::Finder.new)
21
- displayer.display finder.which(method, self), show_non_public
21
+ displayer.display finder.which(method, self), show_public_only
22
22
  end
23
23
  alias :which :mwhich
24
24
  end
@@ -1,8 +1,8 @@
1
1
  module MethodLister
2
2
  class SimpleDisplay
3
- def display(findings, show_non_public=false)
3
+ def display(findings, show_public_only=false)
4
4
  findings.reverse.each do |result|
5
- list = method_list(result, show_non_public)
5
+ list = method_list(result, show_public_only)
6
6
  if !list.empty?
7
7
  puts header(result)
8
8
  puts list
@@ -18,9 +18,9 @@ module MethodLister
18
18
  "========== #{location_description(result)} =========="
19
19
  end
20
20
 
21
- def method_list(result, show_non_public)
21
+ def method_list(result, show_public_only)
22
22
  FindResult::VISIBILITIES.map do |visibility|
23
- (visibility == :public || show_non_public) ?
23
+ (visibility == :public || !show_public_only) ?
24
24
  method_set(result, visibility) :
25
25
  nil
26
26
  end.compact.join("\n\n")
@@ -23,16 +23,16 @@ describe MethodLister::SimpleDisplay do
23
23
  @output.should =~ /Module Kernel.*baz.*Class Object.*bar.*Eigenclass.*foo/m
24
24
  end
25
25
 
26
- it "does not show private methods by default" do
26
+ it "does show private methods by default" do
27
27
  @displayer.display @results
28
- @output.should_not =~ /PRIVATE/
29
- @output.should_not =~ /Class Array/
28
+ @output.should =~ /PRIVATE/
29
+ @output.should =~ /Class Array/
30
30
  end
31
31
 
32
- it "shows private methods if told to" do
32
+ it "shows only public methods if told to" do
33
33
  @displayer.display @results, true
34
- @output.should =~ /PRIVATE/
35
- @output.should =~ /Class Array/
34
+ @output.should_not =~ /PRIVATE/
35
+ @output.should_not =~ /Class Array/
36
36
  end
37
37
  end
38
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matthew-method_lister
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew O'Connor