Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix regression that broke (see OBJ) ref syntax

Fixes #655
  • Loading branch information...
commit 4e54631032bb89f308413744be2a910c8b96f7df 1 parent 2065fbb
@lsegal authored
View
5 lib/yard/docstring.rb
@@ -71,11 +71,14 @@ def hash_flag=(v) @hash_flag = v == nil ? false : v end
# docstring. May be nil.
# @param [String] raw_data the complete docstring, including all
# original formatting and any unparsed tags/directives.
- def self.new!(text, tags = [], object = nil, raw_data = nil)
+ # @param [CodeObjects::Base, nil] A reference object used for the base set
+ # of documentation / tag information.
+ def self.new!(text, tags = [], object = nil, raw_data = nil, ref_object = nil)
docstring = allocate
docstring.replace(text, false)
docstring.object = object
docstring.add_tag(*tags)
+ docstring.instance_variable_set("@unresolved_reference", ref_object)
docstring.instance_variable_set("@all", raw_data) if raw_data
docstring
end
View
2  lib/yard/docstring_parser.rb
@@ -92,7 +92,7 @@ def initialize(library = Tags::Library.instance)
# @return [Docstring] translates parsed text into
# a Docstring object.
def to_docstring
- Docstring.new!(text, tags, object, raw_text)
+ Docstring.new!(text, tags, object, raw_text, reference)
end
# @!group Parsing Methods
View
2  lib/yard/tags/directives.rb
@@ -404,7 +404,7 @@ def create_object
obj.signature = method_signature
obj.parameters = OverloadTag.new(:overload, method_signature).parameters
obj.docstring = Docstring.new!(parser.text, parser.tags, obj,
- parser.raw_text)
+ parser.raw_text, parser.reference)
handler.register_module_function(obj)
obj
end
View
15 spec/docstring_spec.rb
@@ -302,4 +302,19 @@
doc.dup.line_range.should == doc.line_range
end
end
+
+ describe 'reference docstrings' do
+ it 'allows for construction of docstring with ref object' do
+ YARD.parse_string <<-eof
+ class A
+ # Docstring
+ def a; end
+ # (see #a)
+ def b; end
+ end
+ eof
+ YARD::Registry.at('A#b').docstring.should == 'Docstring'
+ YARD::Registry.clear
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.