yard 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/ChangeLog +192 -0
- data/README.md +9 -2
- data/Rakefile +8 -14
- data/lib/yard.rb +1 -1
- data/lib/yard/autoload.rb +3 -2
- data/lib/yard/cli/graph.rb +28 -10
- data/lib/yard/cli/yardoc.rb +4 -1
- data/lib/yard/code_objects/proxy.rb +22 -17
- data/lib/yard/docstring_parser.rb +7 -7
- data/lib/yard/globals.rb +2 -2
- data/lib/yard/handlers/base.rb +3 -2
- data/lib/yard/handlers/c/handler_methods.rb +1 -0
- data/lib/yard/handlers/c/init_handler.rb +7 -5
- data/lib/yard/handlers/c/override_comment_handler.rb +9 -1
- data/lib/yard/handlers/ruby/class_condition_handler.rb +4 -2
- data/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +4 -2
- data/lib/yard/handlers/ruby/legacy/mixin_handler.rb +4 -6
- data/lib/yard/handlers/ruby/mixin_handler.rb +3 -3
- data/lib/yard/handlers/ruby/visibility_handler.rb +1 -1
- data/lib/yard/i18n/locale.rb +50 -0
- data/lib/yard/i18n/text.rb +110 -9
- data/lib/yard/logging.rb +99 -8
- data/lib/yard/parser/c/c_parser.rb +1 -1
- data/lib/yard/parser/source_parser.rb +5 -4
- data/lib/yard/registry.rb +20 -12
- data/lib/yard/registry_store.rb +6 -1
- data/lib/yard/rubygems/doc_manager.rb +9 -5
- data/lib/yard/serializers/yardoc_serializer.rb +1 -0
- data/lib/yard/server/commands/base.rb +3 -2
- data/lib/yard/server/doc_server_serializer.rb +2 -0
- data/lib/yard/server/templates/default/method_details/html/permalink.erb +4 -0
- data/lib/yard/server/templates/default/method_details/html/setup.rb +4 -0
- data/lib/yard/tags/default_factory.rb +12 -4
- data/lib/yard/tags/directives.rb +1 -0
- data/lib/yard/templates/engine.rb +13 -6
- data/lib/yard/templates/template_options.rb +8 -1
- data/spec/cli/graph_spec.rb +10 -0
- data/spec/cli/yri_spec.rb +12 -2
- data/spec/code_objects/proxy_spec.rb +19 -3
- data/spec/handlers/c/class_handler_spec.rb +1 -2
- data/spec/handlers/c/init_handler_spec.rb +11 -0
- data/spec/handlers/c/override_comment_handler_spec.rb +3 -0
- data/spec/handlers/class_condition_handler_spec.rb +5 -0
- data/spec/handlers/dsl_handler_spec.rb +1 -0
- data/spec/handlers/examples/class_condition_handler_001.rb.txt +8 -0
- data/spec/handlers/mixin_handler_spec.rb +2 -1
- data/spec/i18n/locale_spec.rb +62 -0
- data/spec/i18n/text_spec.rb +144 -35
- data/spec/logging_spec.rb +21 -0
- data/spec/parser/c_parser_spec.rb +36 -0
- data/spec/parser/source_parser_spec.rb +11 -8
- data/spec/registry_spec.rb +26 -0
- data/spec/rubygems/doc_manager_spec.rb +112 -0
- data/spec/tags/default_factory_spec.rb +8 -2
- data/spec/tags/directives_spec.rb +7 -0
- data/spec/templates/examples/module001.html +0 -4
- data/spec/templates/examples/module002.html +0 -1
- data/spec/templates/examples/module003.html +0 -1
- data/spec/templates/examples/module004.html +171 -172
- data/spec/templates/module_spec.rb +4 -0
- data/templates/default/fulldoc/html/js/app.js +24 -18
- data/templates/default/fulldoc/html/setup.rb +5 -1
- data/templates/default/module/html/attribute_details.erb +1 -2
- metadata +9 -4
- data/lib/yard/server/templates/default/fulldoc/html/js/live.js +0 -17
data/ChangeLog
CHANGED
@@ -1,3 +1,195 @@
|
|
1
|
+
2012-06-07 Loren Segal <lsegal@soen.ca>
|
2
|
+
|
3
|
+
* ChangeLog, README.md, lib/yard.rb: Bump to version 0.8.2
|
4
|
+
|
5
|
+
2012-06-06 Loren Segal <lsegal@soen.ca>
|
6
|
+
|
7
|
+
* spec/i18n/locale_spec.rb: Fix Locale spec to not use disk
|
8
|
+
|
9
|
+
* lib/yard/i18n/locale.rb: Update Locale documentation
|
10
|
+
|
11
|
+
* lib/yard/i18n/locale.rb: Fix documentation typo
|
12
|
+
|
13
|
+
2012-06-05 Loren Segal <lsegal@soen.ca>
|
14
|
+
|
15
|
+
* lib/yard/server/doc_server_serializer.rb,
|
16
|
+
.../templates/default/fulldoc/html/js/live.js,
|
17
|
+
.../default/method_details/html/permalink.erb,
|
18
|
+
.../templates/default/method_details/html/setup.rb,
|
19
|
+
spec/templates/examples/module001.html,
|
20
|
+
spec/templates/examples/module002.html,
|
21
|
+
spec/templates/examples/module003.html,
|
22
|
+
spec/templates/examples/module004.html, spec/templates/module_spec.rb,
|
23
|
+
.../default/module/html/attribute_details.erb: Make permalinks work for
|
24
|
+
embedded mixins Fixes #540
|
25
|
+
|
26
|
+
* lib/yard/server/commands/base.rb: Ensure that server does not serialize
|
27
|
+
output to disk by default
|
28
|
+
|
29
|
+
2012-05-30 Loren Segal <lsegal@soen.ca>
|
30
|
+
|
31
|
+
* spec/cli/yri_spec.rb: Add test to yri to ensure serialization occurs
|
32
|
+
|
33
|
+
* lib/yard/cli/graph.rb, lib/yard/templates/engine.rb,
|
34
|
+
lib/yard/templates/template_options.rb: Change TemplateOptions#serialize
|
35
|
+
default to true Only serializer option is required to produce output. This
|
36
|
+
is pre-0.8.0 behaviour and is needed for backward compatibility. References
|
37
|
+
#548
|
38
|
+
|
39
|
+
* lib/yard/cli/graph.rb, lib/yard/templates/template_options.rb: Move
|
40
|
+
verifier to TemplateOptions
|
41
|
+
|
42
|
+
* lib/yard/handlers/base.rb,
|
43
|
+
lib/yard/handlers/ruby/class_condition_handler.rb,
|
44
|
+
.../ruby/legacy/class_condition_handler.rb,
|
45
|
+
lib/yard/handlers/ruby/visibility_handler.rb,
|
46
|
+
spec/handlers/class_condition_handler_spec.rb,
|
47
|
+
.../examples/class_condition_handler_001.rb.txt: Accept visibility in
|
48
|
+
push_state and push visibility state in class condition handlers Fixes #551
|
49
|
+
|
50
|
+
2012-05-28 Loren Segal <lsegal@soen.ca>
|
51
|
+
|
52
|
+
* Rakefile: Remove sudo from install task
|
53
|
+
|
54
|
+
* lib/yard/handlers/c/handler_methods.rb, lib/yard/parser/c/c_parser.rb,
|
55
|
+
spec/parser/c_parser_spec.rb: Fix issue with C parser not properly parsing
|
56
|
+
macros with arg## syntax
|
57
|
+
|
58
|
+
2012-05-22 Loren Segal <lsegal@soen.ca>
|
59
|
+
|
60
|
+
* lib/yard/handlers/ruby/legacy/mixin_handler.rb,
|
61
|
+
lib/yard/handlers/ruby/mixin_handler.rb: Ensure that Registry resolution
|
62
|
+
picks a module when parsing a mixin. Fixes #545
|
63
|
+
|
64
|
+
* lib/yard/code_objects/proxy.rb, lib/yard/globals.rb, lib/yard/registry.rb,
|
65
|
+
lib/yard/registry_store.rb, lib/yard/serializers/yardoc_serializer.rb,
|
66
|
+
spec/code_objects/proxy_spec.rb, spec/handlers/c/class_handler_spec.rb,
|
67
|
+
spec/handlers/mixin_handler_spec.rb: Add type initializer to Proxy and P() to
|
68
|
+
constrain Proxy type Also disconnects Registry.proxy_types from Proxy class,
|
69
|
+
since nothing was using this besides the Proxy#type attribute itself. This
|
70
|
+
change modifies a test and no longer allows two separate Proxy objects to
|
71
|
+
maintain the same type information. Proxy type information is stored locally
|
72
|
+
to the proxy object, and no longer tracked in the Registry. Deprecates
|
73
|
+
proxy_types method and tracking in Registry and RegistryStore
|
74
|
+
|
75
|
+
* lib/yard/registry.rb, spec/registry_spec.rb: Ensure that resolve returns
|
76
|
+
proxy fallback with supplied type set
|
77
|
+
|
78
|
+
* lib/yard/registry.rb, spec/registry_spec.rb: Add type verification to
|
79
|
+
Registry.resolve to ensure resolve returns object of intended type
|
80
|
+
|
81
|
+
2012-05-21 Loren Segal <lsegal@soen.ca>
|
82
|
+
|
83
|
+
* lib/yard/cli/graph.rb, spec/cli/graph_spec.rb: Refactor yard graph and fix
|
84
|
+
regression that broke output Fixes #548
|
85
|
+
|
86
|
+
2012-05-20 Kouhei Sutou <kou@clear-code.com>
|
87
|
+
|
88
|
+
* lib/yard/i18n/text.rb, spec/i18n/text_spec.rb: i18n: add
|
89
|
+
YARD::I18n::Text#translate
|
90
|
+
|
91
|
+
* spec/i18n/text_spec.rb: i18n: group existing specs for
|
92
|
+
YARD::I18n::Text#extract_messages
|
93
|
+
|
94
|
+
* lib/yard/i18n/text.rb: i18n: extract text parse code
|
95
|
+
|
96
|
+
* Gemfile, lib/yard/autoload.rb, lib/yard/i18n/locale.rb,
|
97
|
+
spec/i18n/locale_spec.rb: i18n: add YARD::I18n::Locale
|
98
|
+
|
99
|
+
2012-05-19 Loren Segal <lsegal@soen.ca>
|
100
|
+
|
101
|
+
* lib/yard/handlers/c/init_handler.rb, spec/handlers/c/init_handler_spec.rb:
|
102
|
+
Check non-Init methods for object declarations in CRuby code Closes #543
|
103
|
+
|
104
|
+
* templates/default/fulldoc/html/js/app.js: Collapse/expand all summary lists
|
105
|
+
when button on any list is clicked
|
106
|
+
|
107
|
+
* lib/yard/tags/directives.rb, spec/handlers/dsl_handler_spec.rb,
|
108
|
+
spec/tags/directives_spec.rb: Parse parameters from signature in method
|
109
|
+
directive
|
110
|
+
|
111
|
+
2012-05-13 Loren Segal <lsegal@soen.ca>
|
112
|
+
|
113
|
+
* lib/yard/docstring_parser.rb: Make DocstringParser attributes writable
|
114
|
+
|
115
|
+
2012-05-11 Loren Segal <lsegal@soen.ca>
|
116
|
+
|
117
|
+
* lib/yard/handlers/c/override_comment_handler.rb,
|
118
|
+
spec/handlers/c/override_comment_handler_spec.rb: Add proper file info to
|
119
|
+
CRuby override comments
|
120
|
+
|
121
|
+
2012-05-10 Loren Segal <lsegal@soen.ca>
|
122
|
+
|
123
|
+
* lib/yard/templates/template_options.rb: --embed-mixins should ignore
|
124
|
+
methods defined directly on a module
|
125
|
+
|
126
|
+
* lib/yard/registry.rb: Fix registry doc examples
|
127
|
+
|
128
|
+
* lib/yard/docstring_parser.rb: Fix doc references
|
129
|
+
|
130
|
+
* Rakefile: Remove manual loading of .travis.yml in suite task, rvm-tester
|
131
|
+
does this for us, now.
|
132
|
+
|
133
|
+
2012-05-09 Loren Segal <lsegal@soen.ca>
|
134
|
+
|
135
|
+
* Gemfile, Rakefile: Use rvm-tester for suite task
|
136
|
+
|
137
|
+
* lib/yard/logging.rb: Only clear progress in show_progress mode
|
138
|
+
|
139
|
+
* lib/yard/cli/yardoc.rb, lib/yard/logging.rb,
|
140
|
+
lib/yard/parser/source_parser.rb, lib/yard/templates/engine.rb,
|
141
|
+
spec/parser/source_parser_spec.rb, templates/default/fulldoc/html/setup.rb:
|
142
|
+
Add log#progress and log#capture to log output using new progress indicator
|
143
|
+
in 1.9.x. Captures are not fully implemented, but will allow benchmarking of
|
144
|
+
data through a --time-report option in yardoc.
|
145
|
+
|
146
|
+
* lib/yard/templates/template_options.rb: Add #owner to template options
|
147
|
+
|
148
|
+
* Rakefile: No more sudo.
|
149
|
+
|
150
|
+
* lib/yard/logging.rb: Logging should be sent to STDOUT not STDERR
|
151
|
+
|
152
|
+
* lib/yard/cli/yardoc.rb: Re-generating message should be debug, not info
|
153
|
+
|
154
|
+
* Gemfile: Remove RSpec version lock in Gemfile again
|
155
|
+
|
156
|
+
2012-05-08 Loren Segal <lsegal@soen.ca>
|
157
|
+
|
158
|
+
* spec/rubygems/doc_manager_spec.rb: Don't stub all FileUtils methods, just
|
159
|
+
important ones
|
160
|
+
|
161
|
+
* lib/yard/rubygems/doc_manager.rb: Require user_interaction since RubyGems
|
162
|
+
no longer does
|
163
|
+
|
164
|
+
* Gemfile: Re-lock Gemfile due to travis errors
|
165
|
+
|
166
|
+
* spec/rubygems/doc_manager_spec.rb: Require fileutils for specs
|
167
|
+
|
168
|
+
* Gemfile: Unlock rspec in Gemfile
|
169
|
+
|
170
|
+
* lib/yard/logging.rb, lib/yard/parser/source_parser.rb,
|
171
|
+
spec/logging_spec.rb: Parser backtraces should be logged in warn level
|
172
|
+
Closes #541
|
173
|
+
|
174
|
+
* spec/rubygems/doc_manager_spec.rb: Add specs for yard doc installation
|
175
|
+
|
176
|
+
* lib/yard/rubygems/doc_manager.rb, spec/rubygems/doc_manager_spec.rb: Add
|
177
|
+
specs for rubygems plugin code and handle --backtrace and .yardopts files
|
178
|
+
|
179
|
+
2012-05-04 Loren Segal <lsegal@soen.ca>
|
180
|
+
|
181
|
+
* spec/parser/source_parser_spec.rb: Remove and_return on
|
182
|
+
should_not_receive() to fix spec
|
183
|
+
|
184
|
+
* Gemfile: Update Gemfile to deal with RSpec regression rspec/rspec-mocks#132
|
185
|
+
|
186
|
+
* lib/yard/tags/default_factory.rb, spec/tags/default_factory_spec.rb: Fix
|
187
|
+
broken specs, references #535
|
188
|
+
|
189
|
+
* lib/yard/tags/default_factory.rb, spec/tags/default_factory_spec.rb: Fix
|
190
|
+
type parser to properly handle Ruby's operator and special method names
|
191
|
+
Closes #535
|
192
|
+
|
1
193
|
2012-05-02 Loren Segal <lsegal@soen.ca>
|
2
194
|
|
3
195
|
* ChangeLog, README.md, docs/WhatsNew.md, lib/yard.rb: Bump to 0.8.1, update
|
data/README.md
CHANGED
@@ -8,8 +8,8 @@ YARD: Yay! A Ruby Documentation Tool
|
|
8
8
|
**Contributors**: See Contributors section below
|
9
9
|
**Copyright**: 2007-2012
|
10
10
|
**License**: MIT License
|
11
|
-
**Latest Version**: 0.8.
|
12
|
-
**Release Date**:
|
11
|
+
**Latest Version**: 0.8.2 (codename "Shave It")
|
12
|
+
**Release Date**: June 7th 2012
|
13
13
|
|
14
14
|
Synopsis
|
15
15
|
--------
|
@@ -286,6 +286,13 @@ More options can be seen by typing `yard graph --help`, but here is an example:
|
|
286
286
|
|
287
287
|
## Changelog
|
288
288
|
|
289
|
+
- **June.7.12**: 0.8.2 release
|
290
|
+
- Embedded mixins should ignore methods defined on module (#539)
|
291
|
+
- Fixed permalinks for embedded mixins in `yard server` (#540)
|
292
|
+
- Improve parsing in CRuby code (#543)
|
293
|
+
- Ensure Registry.resolve picks module when parsing mixins (#545)
|
294
|
+
- Respect current visibility when parsing class conditions (#551)
|
295
|
+
|
289
296
|
- **May.2.12**: 0.8.1 release
|
290
297
|
- Added `--[no-]api` switch to generate docs for API sets (see {file:docs/WhatsNew.md} for details) (#532)
|
291
298
|
- The `yard list` command now uses cache by default (#533)
|
data/Rakefile
CHANGED
@@ -3,8 +3,6 @@ require File.dirname(__FILE__) + '/lib/yard/rubygems/specification'
|
|
3
3
|
require 'rbconfig'
|
4
4
|
|
5
5
|
YARD::VERSION.replace(ENV['YARD_VERSION']) if ENV['YARD_VERSION']
|
6
|
-
WINDOWS = (RbConfig::CONFIG['host_os'] =~ /mingw|win32|cygwin/ ? true : false) rescue false
|
7
|
-
SUDO = WINDOWS ? '' : 'sudo'
|
8
6
|
|
9
7
|
task :default => :specs
|
10
8
|
|
@@ -15,20 +13,16 @@ end
|
|
15
13
|
|
16
14
|
desc "Installs the gem"
|
17
15
|
task :install => :gem do
|
18
|
-
sh "
|
16
|
+
sh "gem install yard-#{YARD::VERSION}.gem --no-rdoc --no-ri"
|
19
17
|
end
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
puts cmd
|
29
|
-
system(cmd)
|
30
|
-
end
|
31
|
-
end
|
19
|
+
begin
|
20
|
+
require 'rvm-tester'
|
21
|
+
RVM::Tester::TesterTask.new do |t|
|
22
|
+
t.bundle_install = false # don't need to do this all the time
|
23
|
+
t.verbose = true
|
24
|
+
end
|
25
|
+
rescue LoadError
|
32
26
|
end
|
33
27
|
|
34
28
|
task :travis_ci do
|
data/lib/yard.rb
CHANGED
data/lib/yard/autoload.rb
CHANGED
@@ -133,10 +133,11 @@ module YARD
|
|
133
133
|
# Namespace for internationalization (i18n)
|
134
134
|
# @since 0.8.0
|
135
135
|
module I18n
|
136
|
+
autoload :Locale, __p('i18n/locale')
|
137
|
+
autoload :Message, __p('i18n/message')
|
138
|
+
autoload :Messages, __p('i18n/messages')
|
136
139
|
autoload :PotGenerator, __p('i18n/pot_generator')
|
137
140
|
autoload :Text, __p('i18n/text')
|
138
|
-
autoload :Messages, __p('i18n/messages')
|
139
|
-
autoload :Message, __p('i18n/message')
|
140
141
|
end
|
141
142
|
|
142
143
|
# The parser namespace holds all parsing engines used by YARD.
|
data/lib/yard/cli/graph.rb
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
module YARD
|
2
2
|
module CLI
|
3
|
+
# Options to pass to the {Graph} CLI.
|
4
|
+
class GraphOptions < Templates::TemplateOptions
|
5
|
+
# @return [:dot] the default output format
|
6
|
+
default_attr :format, :dot
|
7
|
+
|
8
|
+
# @return [Boolean] whether to list the full class diagram
|
9
|
+
attr_accessor :full
|
10
|
+
|
11
|
+
# @return [Boolean] whether to show the object dependencies
|
12
|
+
attr_accessor :dependencies
|
13
|
+
|
14
|
+
# @return [String] any contents to pass to the digraph
|
15
|
+
attr_accessor :contents
|
16
|
+
end
|
17
|
+
|
3
18
|
# A command-line utility to generate Graphviz graphs from
|
4
19
|
# a set of objects
|
5
20
|
#
|
@@ -17,8 +32,9 @@ module YARD
|
|
17
32
|
# Creates a new instance of the command-line utility
|
18
33
|
def initialize
|
19
34
|
super
|
20
|
-
@
|
21
|
-
|
35
|
+
@options = GraphOptions.new
|
36
|
+
options.reset_defaults
|
37
|
+
options.serializer = YARD::Serializers::StdoutSerializer.new
|
22
38
|
end
|
23
39
|
|
24
40
|
def description
|
@@ -35,10 +51,12 @@ module YARD
|
|
35
51
|
Registry.load
|
36
52
|
optparse(*args)
|
37
53
|
|
38
|
-
contents = objects.map
|
39
|
-
|
40
|
-
|
41
|
-
|
54
|
+
contents = objects.map do |o|
|
55
|
+
o.format(options.merge(:serialize => false))
|
56
|
+
end.join("\n")
|
57
|
+
opts = {:type => :layout, :contents => contents}
|
58
|
+
options.update(opts)
|
59
|
+
Templates::Engine.render(options)
|
42
60
|
end
|
43
61
|
|
44
62
|
private
|
@@ -80,18 +98,18 @@ module YARD
|
|
80
98
|
opts.separator "Output options:"
|
81
99
|
|
82
100
|
opts.on('--dot [OPTIONS]', 'Send the results directly to `dot` with optional arguments.') do |dotopts|
|
83
|
-
|
101
|
+
options.serializer = Serializers::ProcessSerializer.new('dot ' + dotopts.to_s)
|
84
102
|
end
|
85
103
|
|
86
104
|
opts.on('-f', '--file [FILE]', 'Writes output to a file instead of stdout.') do |file|
|
87
|
-
|
88
|
-
|
105
|
+
options.serializer = Serializers::FileSystemSerializer.new(:basepath => '.', :extension => nil)
|
106
|
+
options.serializer.instance_eval "def serialized_path(object) #{file.inspect} end"
|
89
107
|
end
|
90
108
|
|
91
109
|
common_options(opts)
|
92
110
|
parse_options(opts, args)
|
93
111
|
|
94
|
-
|
112
|
+
options.verifier = Verifier.new("object.type != :method || #{visibilities.uniq.inspect}.include?(object.visibility)")
|
95
113
|
if args.first
|
96
114
|
@objects = args.map {|o| Registry.at(o) }.compact
|
97
115
|
else
|
data/lib/yard/cli/yardoc.rb
CHANGED
@@ -241,6 +241,7 @@ module YARD
|
|
241
241
|
# contains a single nil value, skip calling of {#parse_arguments}
|
242
242
|
# @return [void]
|
243
243
|
def run(*args)
|
244
|
+
log.show_progress = true
|
244
245
|
if args.size == 0 || !args.first.nil?
|
245
246
|
# fail early if arguments are not valid
|
246
247
|
return unless parse_arguments(*args)
|
@@ -269,6 +270,8 @@ module YARD
|
|
269
270
|
end
|
270
271
|
|
271
272
|
true
|
273
|
+
ensure
|
274
|
+
log.show_progress = false
|
272
275
|
end
|
273
276
|
|
274
277
|
# Parses commandline arguments
|
@@ -347,7 +350,7 @@ module YARD
|
|
347
350
|
if checksums && serialized && !object.files.any? {|f, line| changed_files.include?(f) }
|
348
351
|
true
|
349
352
|
else
|
350
|
-
log.
|
353
|
+
log.debug "Re-generating object #{object.path}..."
|
351
354
|
false
|
352
355
|
end
|
353
356
|
end
|
@@ -25,7 +25,7 @@ module YARD
|
|
25
25
|
#
|
26
26
|
# @raise [ArgumentError] if namespace is not a NamespaceObject
|
27
27
|
# @return [Proxy] self
|
28
|
-
def initialize(namespace, name)
|
28
|
+
def initialize(namespace, name, type = nil)
|
29
29
|
namespace = Registry.root if !namespace || namespace == :root
|
30
30
|
|
31
31
|
if name =~ /^#{NSEPQ}/
|
@@ -46,6 +46,7 @@ module YARD
|
|
46
46
|
@namespace = namespace
|
47
47
|
@obj = nil
|
48
48
|
@imethod ||= nil
|
49
|
+
self.type = type
|
49
50
|
|
50
51
|
if @namespace.is_a?(ConstantObject)
|
51
52
|
@origname = nil # forget these for a constant
|
@@ -90,19 +91,7 @@ module YARD
|
|
90
91
|
if obj = to_obj
|
91
92
|
obj.path
|
92
93
|
else
|
93
|
-
|
94
|
-
(@imethod ? ISEP : "") + name.to_s
|
95
|
-
elsif @origname
|
96
|
-
if @origname =~ /^[A-Z]/
|
97
|
-
@origname
|
98
|
-
else
|
99
|
-
[namespace.path, @origname].join
|
100
|
-
end
|
101
|
-
elsif name.to_s =~ /^[A-Z]/ # const
|
102
|
-
name.to_s
|
103
|
-
else # class meth?
|
104
|
-
[namespace.path, name.to_s].join(CSEP)
|
105
|
-
end
|
94
|
+
proxy_path
|
106
95
|
end
|
107
96
|
end
|
108
97
|
alias to_s path
|
@@ -168,14 +157,14 @@ module YARD
|
|
168
157
|
if obj = to_obj
|
169
158
|
obj.type
|
170
159
|
else
|
171
|
-
|
160
|
+
@type || :proxy
|
172
161
|
end
|
173
162
|
end
|
174
163
|
|
175
164
|
# Allows a parser to infer the type of the proxy by its path.
|
176
165
|
# @param [#to_sym] type the proxy's inferred type
|
177
166
|
# @return [void]
|
178
|
-
def type=(type)
|
167
|
+
def type=(type) @type = type ? type.to_sym : nil end
|
179
168
|
|
180
169
|
# @return [Boolean]
|
181
170
|
def instance_of?(klass)
|
@@ -235,7 +224,7 @@ module YARD
|
|
235
224
|
# @return [Base, nil] the registered code object or nil
|
236
225
|
def to_obj
|
237
226
|
return @obj if @obj
|
238
|
-
if @obj = Registry.resolve(@namespace, (@imethod ? ISEP : '') + @name.to_s)
|
227
|
+
if @obj = Registry.resolve(@namespace, (@imethod ? ISEP : '') + @name.to_s, false, false, @type)
|
239
228
|
if @origname && @origname.include?("::") && !@obj.path.include?(@origname)
|
240
229
|
# the object's path should include the original proxy namespace,
|
241
230
|
# otherwise it's (probably) not the right object.
|
@@ -247,6 +236,22 @@ module YARD
|
|
247
236
|
end
|
248
237
|
@obj
|
249
238
|
end
|
239
|
+
|
240
|
+
def proxy_path
|
241
|
+
if @namespace.root?
|
242
|
+
(@imethod ? ISEP : "") + name.to_s
|
243
|
+
elsif @origname
|
244
|
+
if @origname =~ /^[A-Z]/
|
245
|
+
@origname
|
246
|
+
else
|
247
|
+
[namespace.path, @origname].join
|
248
|
+
end
|
249
|
+
elsif name.to_s =~ /^[A-Z]/ # const
|
250
|
+
name.to_s
|
251
|
+
else # class meth?
|
252
|
+
[namespace.path, name.to_s].join(CSEP)
|
253
|
+
end
|
254
|
+
end
|
250
255
|
end
|
251
256
|
end
|
252
257
|
end
|