yard-activerecord 0.0.12 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/lib/yard-activerecord/delegations/delegate_handler.rb +17 -5
- data/lib/yard-activerecord/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aeaf569bbe832e74a84f79d8be955264db9a05c
|
4
|
+
data.tar.gz: 34750658b064c355b6247774e0f6937d3a7b701e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 039a602e73581316949cf73a3ca6ff6ca35bf905c68b5a890f1aa6ecc193d91ac2cc39c64431cc6beeccb3070327cca051809fcf16339921605cf4aa6dda00aa
|
7
|
+
data.tar.gz: f314c4bcaa30a81e6314b4408b30fea8811c27adba14da896be1a83354db68e580b1f46b8c861ffd24025a0c41becbebdbb4f151456f9e73437cb31ecc6ffd89
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.5
|
@@ -8,17 +8,29 @@ module YARD::Handlers::Ruby::ActiveRecord::Delegations
|
|
8
8
|
def process
|
9
9
|
params = statement.parameters
|
10
10
|
params.pop # we shouldn't have a block, so pop that off
|
11
|
-
params.map! { |p| p.source }
|
11
|
+
params.map! { |p| p.source.split(",") }
|
12
|
+
params.flatten!
|
12
13
|
options, params = params.partition { |v| v =~ /\=\>|\:\s/ }
|
13
|
-
|
14
|
-
|
14
|
+
if options.length > 0
|
15
|
+
class_name = options.detect { |v| v =~ /to\:\s|\:to\s+\=\>/ }
|
16
|
+
class_name = class_name.to_s.gsub(/\A.*\:/,'').capitalize
|
17
|
+
prefix_name = options.detect { |v| v =~ /prefix\:\s|\:prefix\s+\=\>/ }
|
18
|
+
prefix_name = prefix_name.to_s.gsub(/\A.*\:/,'').strip
|
19
|
+
end
|
20
|
+
|
15
21
|
params.each do |method_name|
|
16
22
|
method_name.gsub!(/[\:\'\"]/,'')
|
23
|
+
original_method_name = method_name.dup
|
24
|
+
|
25
|
+
unless prefix_name.length == 0
|
26
|
+
prefix_name = class_name.downcase if prefix_name == 'true'
|
27
|
+
method_name.prepend("#{prefix_name}_")
|
28
|
+
end
|
17
29
|
object = register YARD::CodeObjects::MethodObject.new(namespace, method_name)
|
18
30
|
object.group = "Delegated Instance Attributes"
|
19
|
-
object.docstring = "Alias for
|
31
|
+
object.docstring = "Alias for #{class_name}##{original_method_name}"
|
20
32
|
object.docstring.add_tag get_tag(:return,
|
21
|
-
"
|
33
|
+
"#{class_name}##{method_name}", 'Object')
|
22
34
|
object.docstring.add_tag get_tag(:see,"Module#delegate",nil,
|
23
35
|
"http://api.rubyonrails.org/classes/Module.html#method-i-delegate")
|
24
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theodor Tonum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -49,6 +49,7 @@ extensions: []
|
|
49
49
|
extra_rdoc_files: []
|
50
50
|
files:
|
51
51
|
- ".gitignore"
|
52
|
+
- ".ruby-version"
|
52
53
|
- Gemfile
|
53
54
|
- LICENSE
|
54
55
|
- README.md
|