class JsDuck::Tag::Method

Implementation of @method tag.

Public Class Methods

new() click to toggle source
# File lib/jsduck/tag/method.rb, line 7
def initialize
  @pattern = "method"
  @tagname = :method
  @member_type = {
    :title => "Methods",
    :position => MEMBER_POS_METHOD,
    :icon => File.dirname(__FILE__) + "/icons/method.png",
    :subsections => [
      {:title => "Instance methods", :filter => {:static => false}, :default => true},
      {:title => "Static methods", :filter => {:static => true}},
    ]
  }
end

Public Instance Methods

merge(h, docs, code) click to toggle source
# File lib/jsduck/tag/method.rb, line 44
def merge(h, docs, code)
  JsDuck::ParamsMerger.merge(h, docs, code)
end
parse_doc(p, pos) click to toggle source

@method name …

# File lib/jsduck/tag/method.rb, line 22
def parse_doc(p, pos)
  {
    :tagname => :method,
    :name => p.ident,
  }
end
process_code(code) click to toggle source
Calls superclass method JsDuck::Tag::MemberTag#process_code
# File lib/jsduck/tag/method.rb, line 35
def process_code(code)
  h = super(code)
  h[:params] = code[:params]
  h[:chainable] = code[:chainable]
  h[:fires] = code[:fires]
  h[:method_calls] = code[:method_calls]
  h
end
process_doc(h, tags, pos) click to toggle source

Onle sets the name when it's actually specified. Otherwise we might overwrite name coming from @constructor.

# File lib/jsduck/tag/method.rb, line 31
def process_doc(h, tags, pos)
  h[:name] = tags[0][:name] if tags[0][:name]
end
to_html(m, cls) click to toggle source
# File lib/jsduck/tag/method.rb, line 48
def to_html(m, cls)
  new_kw(m) + method_link(m, cls) + member_params(m[:params]) + return_value(m)
end

Private Instance Methods

constructor?(m) click to toggle source
# File lib/jsduck/tag/method.rb, line 66
def constructor?(m)
  m[:name] == "constructor"
end
new_kw(m) click to toggle source
# File lib/jsduck/tag/method.rb, line 54
def new_kw(m)
  constructor?(m) ? "<strong class='new-keyword'>new</strong>" : ""
end
return_value(m) click to toggle source
# File lib/jsduck/tag/method.rb, line 70
def return_value(m)
  m[:return] ? (" : " + m[:return][:html_type]) : ""
end