Permalink
Browse files

Merge pull request #9 from jonasoberschweiber/master

Support option hashes for all arguments.
  • Loading branch information...
2 parents 63ebccf + 5dc87fe commit 59f7ece389f0e60dade515437c39b0f90a7e74a0 @trans trans committed Oct 11, 2012
Showing with 19 additions and 4 deletions.
  1. +3 −3 lib/yard-tomdoc.rb
  2. +16 −1 test/unit/test_docstring.rb
View
@@ -37,9 +37,9 @@ def self.yard_parse(yard, comment)
# TODO: how to figure-out class of argument ?
tomdoc.arguments.each {|arg| yard.create_tag(:param, "#{arg.name} #{arg.description}") }
- if last_argument = tomdoc.arguments.last
- last_argument.options.each do |opt|
- yard.create_tag(:option, "#{last_argument.name} #{opt.description}")
+ tomdoc.arguments.each do |arg|
+ arg.options.each do |opt|
+ yard.create_tag(:option, "#{arg.name} #{opt.name} #{opt.description}")
end
end
@@ -19,6 +19,9 @@
#
# text - The String to be duplicated.
# count - The Integer number of times to duplicate the text.
+# options - Options (default: {})
+# :a - Option a
+# :b - Option b
#
# Examples
# multiplex('Tom', 4)
@@ -38,9 +41,21 @@
it "should fill param tags" do
tags = @docstring.tags(:param)
- tags.size.assert == 2
+ tags.size.assert == 3
tags[0].name.assert == 'text'
tags[1].name.assert == 'count'
+ tags[2].name.assert == 'options'
+ end
+
+ it "should fill options tags" do
+ tags = @docstring.tags(:option)
+ tags.size.assert == 2
+ tags[0].name.assert == 'options'
+ tags[0].pair.name.assert == ':a'
+ tags[0].pair.text.assert == 'Option a'
+ tags[1].name.assert == 'options'
+ tags[1].pair.name.assert == ':b'
+ tags[1].pair.text.assert == 'Option b'
end
it "should fill examples tags" do

0 comments on commit 59f7ece

Please sign in to comment.