Loading lib/jsduck/doc/ast.rb +1 −7 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ module JsDuck def create_method(docs, doc_map) return add_shared({ :tagname => :method, :name => detect_name(:method, doc_map), :doc => detect_doc(docs), :params => detect_params(doc_map), :return => detect_return(doc_map), Loading Loading @@ -120,12 +119,7 @@ module JsDuck end def detect_name(tagname, doc_map) name = extract(doc_map, tagname, :name) if name name else doc_map[:constructor] ? "constructor" : nil end extract(doc_map, tagname, :name) end def extract(doc_map, tagname, propname = nil) Loading lib/jsduck/tag/constructor.rb +7 −0 Original line number Diff line number Diff line Loading @@ -4,11 +4,18 @@ module JsDuck::Tag class Constructor < Tag def initialize @pattern = "constructor" @key = :constructor end # @constructor def parse(p) {:tagname => :constructor} end # The method name will become "constructor" unless a separate # @method tag already supplied the name. def process_doc(h, tags) h[:name] = "constructor" unless h[:name] end end end lib/jsduck/tag/method.rb +7 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ module JsDuck::Tag class Method < Tag def initialize @pattern = "method" @key = :method @member_type = :method end Loading @@ -15,5 +16,11 @@ module JsDuck::Tag :name => p.hw.ident, } end # Onle sets the name when it's actually specified. # Otherwise we might overwrite name coming from @constructor. def process_doc(h, tags) h[:name] = tags[0][:name] if tags[0][:name] end end end Loading
lib/jsduck/doc/ast.rb +1 −7 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ module JsDuck def create_method(docs, doc_map) return add_shared({ :tagname => :method, :name => detect_name(:method, doc_map), :doc => detect_doc(docs), :params => detect_params(doc_map), :return => detect_return(doc_map), Loading Loading @@ -120,12 +119,7 @@ module JsDuck end def detect_name(tagname, doc_map) name = extract(doc_map, tagname, :name) if name name else doc_map[:constructor] ? "constructor" : nil end extract(doc_map, tagname, :name) end def extract(doc_map, tagname, propname = nil) Loading
lib/jsduck/tag/constructor.rb +7 −0 Original line number Diff line number Diff line Loading @@ -4,11 +4,18 @@ module JsDuck::Tag class Constructor < Tag def initialize @pattern = "constructor" @key = :constructor end # @constructor def parse(p) {:tagname => :constructor} end # The method name will become "constructor" unless a separate # @method tag already supplied the name. def process_doc(h, tags) h[:name] = "constructor" unless h[:name] end end end
lib/jsduck/tag/method.rb +7 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ module JsDuck::Tag class Method < Tag def initialize @pattern = "method" @key = :method @member_type = :method end Loading @@ -15,5 +16,11 @@ module JsDuck::Tag :name => p.hw.ident, } end # Onle sets the name when it's actually specified. # Otherwise we might overwrite name coming from @constructor. def process_doc(h, tags) h[:name] = tags[0][:name] if tags[0][:name] end end end