Class: JsDuck::Tag::Method

Inherits:
MemberTag show all
Defined in:
lib/jsduck/tag/method.rb

Overview

Implementation of @method tag.

Constant Summary

Constants inherited from MemberTag

JsDuck::Tag::MemberTag::MEMBER_POS_CFG, JsDuck::Tag::MemberTag::MEMBER_POS_CSS_MIXIN, JsDuck::Tag::MemberTag::MEMBER_POS_CSS_VAR, JsDuck::Tag::MemberTag::MEMBER_POS_EVENT, JsDuck::Tag::MemberTag::MEMBER_POS_METHOD, JsDuck::Tag::MemberTag::MEMBER_POS_PROPERTY

Constants inherited from Tag

Tag::POS_ASIDE, Tag::POS_DEFAULT, Tag::POS_DEPRECATED, Tag::POS_DOC, Tag::POS_ENUM, Tag::POS_FIRES, Tag::POS_LOCALDOC, Tag::POS_OVERRIDES, Tag::POS_PARAM, Tag::POS_PREVENTABLE, Tag::POS_PRIVATE, Tag::POS_RETURN, Tag::POS_SINCE, Tag::POS_SUBPROPERTIES, Tag::POS_TEMPLATE, Tag::POS_THROWS

Instance Attribute Summary

Attributes inherited from MemberTag

#member_type

Attributes inherited from Tag

#css, #ext_define_default, #ext_define_pattern, #html_position, #pattern, #repeatable, #signature, #tagname

Instance Method Summary collapse

Methods inherited from MemberTag

#member_link, #member_params

Methods inherited from Tag

descendants, #format, #parse_ext_define

Constructor Details

#initializeMethod

Returns a new instance of Method.



7
8
9
10
11
12
13
14
15
16
17
18
19
# 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

Instance Method Details

#merge(h, docs, code) ⇒ Object



44
45
46
# File 'lib/jsduck/tag/method.rb', line 44

def merge(h, docs, code)
  JsDuck::ParamsMerger.merge(h, docs, code)
end

#name(...) ⇒ Object



22
23
24
25
26
27
# File 'lib/jsduck/tag/method.rb', line 22

def parse_doc(p, pos)
  {
    :tagname => :method,
    :name => p.ident,
  }
end

#parse_doc(p, pos) ⇒ Object



22
23
24
25
26
27
# File 'lib/jsduck/tag/method.rb', line 22

def parse_doc(p, pos)
  {
    :tagname => :method,
    :name => p.ident,
  }
end

#process_code(code) ⇒ Object



35
36
37
38
39
40
41
42
# 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) ⇒ Object

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



31
32
33
# 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) ⇒ Object



48
49
50
# 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