Class: JsDuck::Tag::CssVar

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

Constant Summary

Constants inherited from MemberTag

MemberTag::MEMBER_POS_CFG, MemberTag::MEMBER_POS_CSS_MIXIN, MemberTag::MEMBER_POS_CSS_VAR, MemberTag::MEMBER_POS_EVENT, MemberTag::MEMBER_POS_METHOD, 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

#initializeCssVar

Returns a new instance of CssVar.



5
6
7
8
9
10
11
12
13
14
# File 'lib/jsduck/tag/css_var.rb', line 5

def initialize
  @pattern = "var"
  @tagname = :css_var
  @member_type = {
    :title => "CSS Variables",
    :toolbar_title => "CSS Vars",
    :position => MEMBER_POS_CSS_VAR,
    :icon => File.dirname(__FILE__) + "/icons/css_var.png"
  }
end

Instance Method Details

#merge(h, docs, code) ⇒ Object

Set default value for :type field



42
43
44
# File 'lib/jsduck/tag/css_var.rb', line 42

def merge(h, docs, code)
  h[:type] = "Object" unless h[:type]
end

#parse_doc(p, pos) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/jsduck/tag/css_var.rb', line 17

def parse_doc(p, pos)
  p.standard_tag({
      :tagname => :css_var,
      :type => true,
      :name => true,
      :default => true,
      :optional => true
    })
end

#process_code(code) ⇒ Object



34
35
36
37
38
39
# File 'lib/jsduck/tag/css_var.rb', line 34

def process_code(code)
  h = super(code)
  h[:type] = code[:type]
  h[:default] = code[:default]
  h
end

#process_doc(h, tags, pos) ⇒ Object



27
28
29
30
31
32
# File 'lib/jsduck/tag/css_var.rb', line 27

def process_doc(h, tags, pos)
  p = tags[0]
  h[:name] = p[:name]
  h[:type] = p[:type]
  h[:default] = p[:default]
end

#to_html(var, cls) ⇒ Object



46
47
48
# File 'lib/jsduck/tag/css_var.rb', line 46

def to_html(var, cls)
  member_link(var) + " : " + var[:html_type]
end