Class: Erlapi::Parser::Module

Inherits:
Object
  • Object
show all
Defined in:
lib/erlapi/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parser, doc) ⇒ Module

Returns a new instance of Module.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/erlapi/parser.rb', line 63

def initialize(parser, doc)
  self.doc = doc
  self.parser = parser
  self.title = doc.css('module').inner_html
  self.summary = doc.css('modulesummary').inner_html || ''
  if self.title && self.title != ''
    self.valid = true
  else
    self.valid = false
  end
  if valid
    define_desc
    define_sections
    define_funcs
  end
end

Instance Attribute Details

#datatypesObject

Returns the value of attribute datatypes.



62
63
64
# File 'lib/erlapi/parser.rb', line 62

def datatypes
  @datatypes
end

#descObject

Returns the value of attribute desc.



62
63
64
# File 'lib/erlapi/parser.rb', line 62

def desc
  @desc
end

#docObject

Returns the value of attribute doc.



62
63
64
# File 'lib/erlapi/parser.rb', line 62

def doc
  @doc
end

#funcsObject

Returns the value of attribute funcs.



62
63
64
# File 'lib/erlapi/parser.rb', line 62

def funcs
  @funcs
end

#parserObject

Returns the value of attribute parser.



62
63
64
# File 'lib/erlapi/parser.rb', line 62

def parser
  @parser
end

#sectionsObject

Returns the value of attribute sections.



62
63
64
# File 'lib/erlapi/parser.rb', line 62

def sections
  @sections
end

#summaryObject

Returns the value of attribute summary.



62
63
64
# File 'lib/erlapi/parser.rb', line 62

def summary
  @summary
end

#titleObject

Returns the value of attribute title.



62
63
64
# File 'lib/erlapi/parser.rb', line 62

def title
  @title
end

#validObject

Returns the value of attribute valid.



62
63
64
# File 'lib/erlapi/parser.rb', line 62

def valid
  @valid
end

Instance Method Details

#define_descObject



80
81
82
# File 'lib/erlapi/parser.rb', line 80

def define_desc
  self.desc = self.parser.special_tags(self.parser.inner_xml(doc.css('description')))
end

#define_funcsObject



91
92
93
94
95
96
97
# File 'lib/erlapi/parser.rb', line 91

def define_funcs
  self.funcs = []
  doc.css('funcs func').each do |node|
    func = Erlapi::Parser::Func.new(self, node)
    self.funcs << func if func.short_name
  end
end

#define_sectionsObject



84
85
86
87
88
89
# File 'lib/erlapi/parser.rb', line 84

def define_sections
  self.sections = []
  doc.css('section').each do |node|
    self.sections << Erlapi::Parser::Section.new(self, node)
  end
end