Loading doc_comment_parser.rb +13 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,8 @@ module JsDuck at_extends elsif look(/@singleton\b/) then at_singleton elsif look(/@private\b/) then at_private elsif look(/@event\b/) then at_event elsif look(/@method\b/) then Loading Loading @@ -128,6 +130,17 @@ module JsDuck skip_white end # matches @private # sets :private property to true on the root tag def at_private match(/@private/) tagname = [:class, :method, :event, :property, :default].find {|name| @tags[name]} if tagname @tags[tagname][:private] = true end skip_white end # matches @event name ... def at_event match(/@event/) Loading tc_doc_comment_parser.rb +47 −0 Original line number Diff line number Diff line Loading @@ -229,5 +229,52 @@ class TestDocCommentParser < Test::Unit::TestCase assert_equal(nil, doc[:param][0][:name]) assert_equal("My parameter.", doc[:param][0][:doc]) end def test_private_class doc = parse_single("/** * @class Foo * Blah blah * @private */") assert(doc[:class][:private]) end def test_private_method doc = parse_single("/** * @method foo * Some method * @param {type} x * @private */") assert(doc[:method][:private]) end def test_private_event doc = parse_single("/** * @event foo * Some prop * @param {type} x * @private */") assert(doc[:event][:private]) end def test_private_property doc = parse_single("/** * @property foo * Some prop * @private */") assert(doc[:property][:private]) end def test_private_default doc = parse_single("/** * Some docs * @private */") assert(doc[:default][:private]) end end Loading
doc_comment_parser.rb +13 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,8 @@ module JsDuck at_extends elsif look(/@singleton\b/) then at_singleton elsif look(/@private\b/) then at_private elsif look(/@event\b/) then at_event elsif look(/@method\b/) then Loading Loading @@ -128,6 +130,17 @@ module JsDuck skip_white end # matches @private # sets :private property to true on the root tag def at_private match(/@private/) tagname = [:class, :method, :event, :property, :default].find {|name| @tags[name]} if tagname @tags[tagname][:private] = true end skip_white end # matches @event name ... def at_event match(/@event/) Loading
tc_doc_comment_parser.rb +47 −0 Original line number Diff line number Diff line Loading @@ -229,5 +229,52 @@ class TestDocCommentParser < Test::Unit::TestCase assert_equal(nil, doc[:param][0][:name]) assert_equal("My parameter.", doc[:param][0][:doc]) end def test_private_class doc = parse_single("/** * @class Foo * Blah blah * @private */") assert(doc[:class][:private]) end def test_private_method doc = parse_single("/** * @method foo * Some method * @param {type} x * @private */") assert(doc[:method][:private]) end def test_private_event doc = parse_single("/** * @event foo * Some prop * @param {type} x * @private */") assert(doc[:event][:private]) end def test_private_property doc = parse_single("/** * @property foo * Some prop * @private */") assert(doc[:property][:private]) end def test_private_default doc = parse_single("/** * Some docs * @private */") assert(doc[:default][:private]) end end