class JsDuck::Tag::Cfg
Public Class Methods
new()
click to toggle source
# File lib/jsduck/tag/cfg.rb, line 6 def initialize @pattern = "cfg" @tagname = :cfg @repeatable = true @member_type = { :title => "Config options", :toolbar_title => "Configs", :position => MEMBER_POS_CFG, :icon => File.dirname(__FILE__) + "/icons/cfg.png", :subsections => [ {:title => "Required config options", :filter => {:required => true}}, {:title => "Optional config options", :filter => {:required => false}, :default => true}, ] } end
Public Instance Methods
merge(h, docs, code)
click to toggle source
Do the merging of :type field
# File lib/jsduck/tag/cfg.rb, line 69 def merge(h, docs, code) if h[:type] == nil h[:type] = code[:tagname] == :method ? "Function" : "Object" end end
parse_doc(p, pos)
click to toggle source
@cfg {Type} [name=default] (required) …
# File lib/jsduck/tag/cfg.rb, line 23 def parse_doc(p, pos) tag = p.standard_tag({ :tagname => :cfg, :type => true, :name => true, :default => true, :optional => true }) # don't parse (required) after subproperties unless tag[:name] =~ /\./ tag[:optional] = false if parse_required(p) end tag[:doc] = :multiline tag end
parse_required(p)
click to toggle source
# File lib/jsduck/tag/cfg.rb, line 41 def parse_required(p) p.hw.match(/\(required\)/i) end
process_code(code)
click to toggle source
Calls superclass method
# File lib/jsduck/tag/cfg.rb, line 59 def process_code(code) h = super(code) h[:type] = code[:type] h[:default] = code[:default] h[:accessor] = code[:accessor] h[:evented] = code[:evented] h end
process_doc(h, tags, pos)
click to toggle source
# File lib/jsduck/tag/cfg.rb, line 45 def process_doc(h, tags, pos) p = tags[0] h[:type] = p[:type] h[:default] = p[:default] h[:required] = true if p[:optional] == false # Documentation after the first @cfg is part of the top-level docs. h[:doc] += p[:doc] nested = JsDuck::Doc::Subproperties.nest(tags, pos)[0] h[:properties] = nested[:properties] h[:name] = nested[:name] end
to_html(cfg, cls)
click to toggle source
# File lib/jsduck/tag/cfg.rb, line 75 def to_html(cfg, cls) member_link(cfg) + " : " + cfg[:html_type] end