Loading doc_comment.rb +13 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ module JsDuck at_class elsif look(/@extends\b/) then at_extends elsif look(/@event\b/) then at_event elsif look(/@function\b/) then at_function elsif look(/@param\b/) then Loading Loading @@ -130,6 +132,17 @@ module JsDuck skip_white end # matches @event name ... def at_event match(/@event/) @current_tag = @tags[:event] = {:doc => ""} skip_white if look(/\w/) then @current_tag[:name] = ident end skip_white end # matches @return {type} ... def at_function match(/@function/) Loading tc_doc_comment.rb +9 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,15 @@ class TestDocComment < Test::Unit::TestCase assert_equal("Some docs.", doc[:class][:doc]) end def test_event doc = JsDuck::DocComment.new("/** * @event mousedown * Fires when the mouse button is depressed. */") assert_equal("mousedown", doc[:event][:name]) assert_equal("Fires when the mouse button is depressed.", doc[:event][:doc]) end def test_long_docs doc = JsDuck::DocComment.new("/** * @function foo Loading tc_jsduck.rb +1 −1 File changed.Contains only whitespace changes. Show changes Loading
doc_comment.rb +13 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ module JsDuck at_class elsif look(/@extends\b/) then at_extends elsif look(/@event\b/) then at_event elsif look(/@function\b/) then at_function elsif look(/@param\b/) then Loading Loading @@ -130,6 +132,17 @@ module JsDuck skip_white end # matches @event name ... def at_event match(/@event/) @current_tag = @tags[:event] = {:doc => ""} skip_white if look(/\w/) then @current_tag[:name] = ident end skip_white end # matches @return {type} ... def at_function match(/@function/) Loading
tc_doc_comment.rb +9 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,15 @@ class TestDocComment < Test::Unit::TestCase assert_equal("Some docs.", doc[:class][:doc]) end def test_event doc = JsDuck::DocComment.new("/** * @event mousedown * Fires when the mouse button is depressed. */") assert_equal("mousedown", doc[:event][:name]) assert_equal("Fires when the mouse button is depressed.", doc[:event][:doc]) end def test_long_docs doc = JsDuck::DocComment.new("/** * @function foo Loading