cinch-rubydoc 0.2.0 → 0.3.0
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.
- checksums.yaml +4 -4
- data/lib/cinch/rubydoc.rb +38 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6735fdcb01f5f645760056e563e842db5d385c35
|
4
|
+
data.tar.gz: 66f7dd565ec12d41f26b8f315e705e1b507236af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 304586cd08b0685c7709d5021b55a35fa69df943a5b1dfac28cda0b8dec4ff868d5f3a82b4b31cb46b9e7afed39f94907ab1143fe148f2f4c1b75d8fa69276b8
|
7
|
+
data.tar.gz: 4f2545e376a9bb816266ef811cd4cdc87d6cec2c87ef0d569c7ea04ce190af598141820104d4c71357585edfd2cc9068d2bdcf8dd3afad9b0f74b6180f0f9a01
|
data/lib/cinch/rubydoc.rb
CHANGED
@@ -16,7 +16,7 @@ module Cinch
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def execute(m, request)
|
19
|
-
requests = request.split
|
19
|
+
requests = request.split /[ ,]+/
|
20
20
|
if requests.count > 3
|
21
21
|
requests = requests.first(3)
|
22
22
|
end
|
@@ -41,6 +41,28 @@ module Cinch
|
|
41
41
|
obj = @store[name.sub(/\.new\z/, '#initialize')]
|
42
42
|
end
|
43
43
|
|
44
|
+
if obj.nil? && name =~ /(::|#|\.)/
|
45
|
+
klass, scope, meth = name.rpartition(/(::|#|\.)/)
|
46
|
+
okls = @store[klass]
|
47
|
+
|
48
|
+
if okls
|
49
|
+
obj = okls.meths.find do |e|
|
50
|
+
e.name == meth.to_sym && e.scope == to_scope(scope)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
if obj.nil? && okls && okls.type == :class && klass != 'BasicObject'
|
55
|
+
# Check if "forgotten" parts of the tree, too
|
56
|
+
[Object, BasicObject].each do |o|
|
57
|
+
obj = @store[o.name].meths.find do |e|
|
58
|
+
e.name == meth.to_sym && e.scope == to_scope(scope)
|
59
|
+
end
|
60
|
+
|
61
|
+
break if obj
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
44
66
|
unless obj
|
45
67
|
debug "Nothing found for #{name}"
|
46
68
|
return nil
|
@@ -58,11 +80,23 @@ module Cinch
|
|
58
80
|
def path_for(obj)
|
59
81
|
case obj.type
|
60
82
|
when :method
|
61
|
-
|
83
|
+
scope = obj.module_function? ? 'instance' : obj.scope
|
84
|
+
"#{path_for obj.parent}##{CGI.escape obj.name.to_s}-#{scope}_method"
|
62
85
|
when :constant
|
63
|
-
|
86
|
+
"#{path_for obj.parent}##{obj.name}-constant"
|
64
87
|
when :class, :module
|
65
|
-
|
88
|
+
obj.path.gsub('::', '/')
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def to_scope(symbol)
|
93
|
+
case symbol
|
94
|
+
when '::', '.'
|
95
|
+
:class
|
96
|
+
when '#'
|
97
|
+
:instance
|
98
|
+
else
|
99
|
+
throw 'Invalid symbol'
|
66
100
|
end
|
67
101
|
end
|
68
102
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cinch-rubydoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibault `Adædra` Hamel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cinch
|