find_method 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -3
- data/VERSION +1 -1
- data/lib/find_method.rb +3 -16
- metadata +3 -3
data/README.markdown
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# find_method
|
2
2
|
|
3
|
-
Sometimes, you just remember part of a method name and you
|
4
|
-
through the whole list.
|
3
|
+
Sometimes, you just remember part of a method name and you don't want to go
|
4
|
+
through the whole method list, you don't want to Google either.
|
5
5
|
|
6
6
|
## Usage
|
7
7
|
|
@@ -10,7 +10,7 @@ through the whole list.
|
|
10
10
|
AnyClass.find_method("module") # => ["module_eval", "module_exec", "included_modules"]
|
11
11
|
|
12
12
|
any_object = AnyClass.new
|
13
|
-
any_object.find_method("
|
13
|
+
any_object.find_method("enum") # => ["to_enum", "enum_for"]
|
14
14
|
|
15
15
|
### Rails
|
16
16
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/find_method.rb
CHANGED
@@ -1,22 +1,9 @@
|
|
1
1
|
module FindMethod
|
2
|
-
|
3
|
-
|
4
|
-
methods.select {|m| Regexp.new(query).match(m)}
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
module InstanceMethods
|
9
|
-
def find_method(query)
|
10
|
-
methods.select {|m| Regexp.new(query).match(m)}
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.included(receiver)
|
15
|
-
receiver.extend ClassMethods
|
16
|
-
receiver.send :include, InstanceMethods
|
2
|
+
def find_method(query)
|
3
|
+
methods.grep(Regexp.new(query))
|
17
4
|
end
|
18
5
|
end
|
19
6
|
|
20
7
|
class Object
|
21
|
-
include FindMethod
|
8
|
+
[:include, :extend].each {|m| send(m, FindMethod)}
|
22
9
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: find_method
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Padilla
|