Skip to content

Commit

Permalink
Don't add period to summary if entire summary is {include:...} expr…
Browse files Browse the repository at this point in the history
…ession.

Closes #569
  • Loading branch information
lsegal committed Jul 14, 2012
1 parent f374d2b commit c7eaa97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/yard/docstring.rb
Expand Up @@ -173,7 +173,9 @@ def summary
end end
end end
@summary = self[0..idx] @summary = self[0..idx]
@summary += '.' unless @summary.empty? if !@summary.empty? && @summary !~ /\A\s*\{include:.+\}\s*\Z/
@summary += '.'
end
@summary @summary
end end


Expand Down
6 changes: 6 additions & 0 deletions spec/docstring_spec.rb
Expand Up @@ -83,6 +83,12 @@
doc.summary.should == "Returns a list of tags specified by +name+ or all tags if +name+ is not specified." doc.summary.should == "Returns a list of tags specified by +name+ or all tags if +name+ is not specified."
end end


it "should not attach period if entire summary is include" do
YARD.parse_string "# docstring\ndef foo; end"
Docstring.new("{include:#foo}").summary.should == '{include:#foo}'
Registry.clear
end

it "should handle references embedded in summary" do it "should handle references embedded in summary" do
Docstring.new("Aliasing {Test.test}. Done.").summary.should == "Aliasing {Test.test}." Docstring.new("Aliasing {Test.test}. Done.").summary.should == "Aliasing {Test.test}."
end end
Expand Down

0 comments on commit c7eaa97

Please sign in to comment.