mmmm 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mmmm/src_loc.rb +26 -3
- data/lib/mmmm/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 355b6e4fe1af02875a46c394cf82339e21fc3058
|
4
|
+
data.tar.gz: 33f3f2e282de829772fcac530056a92d16db942d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9322e14ef3a4ee3d95294a24413d9d593a9dcdd9e9ed217f095a93e70fdf2c2e8af8073f27cd41a2e6e7af31d7c66b7e7ad9bc901a4141480426b1797ec62e3
|
7
|
+
data.tar.gz: aa794b129795b4c98a204e743adad8a734a3a26d3ea0b92ec3c29f2da5080423603ae93c850e1710115692849fc3039ab9ca99d7636db48797d0cef21f574875
|
data/lib/mmmm/src_loc.rb
CHANGED
@@ -19,9 +19,32 @@ module Mmmm
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def src_loc obj,
|
23
|
-
|
24
|
-
|
22
|
+
def src_loc obj, method_name
|
23
|
+
ancs = all_ancestors(obj)
|
24
|
+
instance_method_locations(method_name, ancs).
|
25
|
+
each do |file, line|
|
26
|
+
puts [cyan(file), line].join ' '
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def all_ancestors obj
|
31
|
+
obj.
|
32
|
+
singleton_class.
|
33
|
+
ancestors
|
34
|
+
end
|
35
|
+
|
36
|
+
def instance_method_locations method_name, mods
|
37
|
+
mods.each_with_object([]) do |class_or_module, locs|
|
38
|
+
loc = instance_method_location method_name, class_or_module
|
39
|
+
locs << loc unless loc.nil?
|
40
|
+
end.
|
41
|
+
uniq
|
42
|
+
end
|
43
|
+
|
44
|
+
def instance_method_location method_name, mod
|
45
|
+
mod.instance_method(method_name).source_location
|
46
|
+
rescue NameError => e
|
47
|
+
nil
|
25
48
|
end
|
26
49
|
|
27
50
|
def all_src_loc obj
|
data/lib/mmmm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmmm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ken
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.6.7
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: find (all) method source location
|