Class: Cocoadex::ConstantGroup

Inherits:
SequentialNodeElement show all
Defined in:
lib/cocoadex/models/constant.rb

Constant Summary collapse

TEMPLATE_NAME =
:constant_group

Constants inherited from SequentialNodeElement

SequentialNodeElement::Abstract, SequentialNodeElement::Availability, SequentialNodeElement::Declaration, SequentialNodeElement::DeclaredIn, SequentialNodeElement::Discussion, SequentialNodeElement::ReturnValue, SequentialNodeElement::Special

Instance Attribute Summary collapse

Attributes inherited from Element

#name

Instance Method Summary collapse

Methods inherited from SequentialNodeElement

#initialize, #origin, #parse

Methods inherited from Element

#<=>, #origin, #parse_parameters, #print, #to_s, #type

Methods included from Bri::Templates::Helpers

h3, inline_title, wrap

Constructor Details

This class inherits a constructor from Cocoadex::SequentialNodeElement

Instance Attribute Details

#abstractObject (readonly)

Returns the value of attribute abstract.



6
7
8
# File 'lib/cocoadex/models/constant.rb', line 6

def abstract
  @abstract
end

#declarationObject (readonly)

Returns the value of attribute declaration.



6
7
8
# File 'lib/cocoadex/models/constant.rb', line 6

def declaration
  @declaration
end

#declared_inObject (readonly)

Returns the value of attribute declared_in.



6
7
8
# File 'lib/cocoadex/models/constant.rb', line 6

def declared_in
  @declared_in
end

#discussionObject (readonly)

Returns the value of attribute discussion.



6
7
8
# File 'lib/cocoadex/models/constant.rb', line 6

def discussion
  @discussion
end

Instance Method Details

#constantsObject



9
10
11
# File 'lib/cocoadex/models/constant.rb', line 9

def constants
  @constants ||= []
end

#handle_node(node) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cocoadex/models/constant.rb', line 13

def handle_node node
  if node.classes.include? "termdef"
    node.css("dt").each do |field_title_node|
      source = "#{@origin} > #{@name}"
      field_name  = field_title_node.css("code").text
      description = field_title_node.next.css("p").map {|p| p.text}.join("\n")
      constants << Constant.new(source,field_name, description)
    end
  elsif node.name == "p" and node.classes.empty?
    @abstract = node.text
  end
end