Class: Cocoadex::DataType

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

Defined Under Namespace

Classes: Field

Constant Summary collapse

TEMPLATE_NAME =
:data_type

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, #parse

Methods inherited from Element

#<=>, #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.



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

def abstract
  @abstract
end

#availabilityObject (readonly)

Returns the value of attribute availability.



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

def availability
  @availability
end

#considerationsObject (readonly)

Returns the value of attribute considerations.



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

def considerations
  @considerations
end

#declarationObject (readonly)

Returns the value of attribute declaration.



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

def declaration
  @declaration
end

#declared_inObject (readonly)

Returns the value of attribute declared_in.



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

def declared_in
  @declared_in
end

#discussionObject (readonly)

Returns the value of attribute discussion.



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

def discussion
  @discussion
end

#next_termdefObject

Returns the value of attribute next_termdef.



11
12
13
# File 'lib/cocoadex/models/data_type.rb', line 11

def next_termdef
  @next_termdef
end

Instance Method Details

#constantsObject



17
18
19
# File 'lib/cocoadex/models/data_type.rb', line 17

def constants
  @constants ||= []
end

#fieldsObject



13
14
15
# File 'lib/cocoadex/models/data_type.rb', line 13

def fields
  @fields ||= []
end

#handle_node(node) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/cocoadex/models/data_type.rb', line 25

def handle_node node
  if ["Fields","Constants"].include? node.text
    next_termdef = node.text
  elsif node.classes.include? "termdef" and not next_termdef.nil?
    if list = termdef_to_properties(next_termdef)
      node.css("dt").each do |field_title_node|
        field_name  = field_title_node.css("code").text
        description = field_title_node.next.text
        list << Field.new(field_name, description)
      end
      next_termdef = ""
    end
  end
end

#originObject



21
22
23
# File 'lib/cocoadex/models/data_type.rb', line 21

def origin
  @origin
end

#termdef_to_properties(termdef) ⇒ Object



40
41
42
43
44
45
# File 'lib/cocoadex/models/data_type.rb', line 40

def termdef_to_properties termdef
  case termdef
  when "Fields" then fields
  when "Constants" then constants
  end
end