Skip to content

Commit

Permalink
Remove leading space from examples. [bug]
Browse files Browse the repository at this point in the history
Note this should fixed in TomParse instead.
  • Loading branch information
trans committed Jun 14, 2012
1 parent 2be6950 commit 02eb40e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/yard-tomdoc.rb
Expand Up @@ -31,7 +31,8 @@ def self.const_missing(name)
def self.yard_parse(yard, comment) def self.yard_parse(yard, comment)
tomdoc = TomParse.parse(comment) tomdoc = TomParse.parse(comment)


tomdoc.examples.each {|ex| yard.create_tag(:example, "\n" + ex) } # TODO: TomParse should make the `strip` unecessary
tomdoc.examples.each {|ex| yard.create_tag(:example, "\n" + ex.strip) }


# TODO: how to figure-out class of argument ? # TODO: how to figure-out class of argument ?
tomdoc.arguments.each {|arg| yard.create_tag(:param, "#{arg.name} #{arg.description}") } tomdoc.arguments.each {|arg| yard.create_tag(:param, "#{arg.name} #{arg.description}") }
Expand Down
8 changes: 4 additions & 4 deletions test/unit/test_docstring.rb
Expand Up @@ -6,10 +6,10 @@
describe YARD::Docstring do describe YARD::Docstring do


make_docstring = Proc.new do |comment| make_docstring = Proc.new do |comment|
if YARD::VERSION < '0.8' if YARD::VERSION == '0.8.0'
YARD::Docstring.new(comment)
else
YARD::DocstringParser.new.parse(comment, self).to_docstring YARD::DocstringParser.new.parse(comment, self).to_docstring
else
YARD::Docstring.new(comment)
end end
end end


Expand Down Expand Up @@ -45,7 +45,7 @@


it "should fill examples tags" do it "should fill examples tags" do
@docstring.tags(:example).size.assert == 1 @docstring.tags(:example).size.assert == 1
@docstring.tag(:example).text.assert == "multiplex('Tom', 4)\n # => 'TomTomTomTom'" @docstring.tag(:example).text.assert == "multiplex('Tom', 4)\n# => 'TomTomTomTom'"
end end


it "should fill return tag" do it "should fill return tag" do
Expand Down

0 comments on commit 02eb40e

Please sign in to comment.