Class: Smi::Module

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/smi/module.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ Module

Returns a new instance of Module.



23
24
25
# File 'lib/smi/module.rb', line 23

def initialize(ptr)
  @struct = ptr
end

Instance Attribute Details

#conformanceObject

Returns the value of attribute conformance.



4
5
6
# File 'lib/smi/module.rb', line 4

def conformance
  @conformance
end

#contactinfoObject

Returns the value of attribute contactinfo.



4
5
6
# File 'lib/smi/module.rb', line 4

def contactinfo
  @contactinfo
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/smi/module.rb', line 4

def description
  @description
end

#languageObject

Returns the value of attribute language.



4
5
6
# File 'lib/smi/module.rb', line 4

def language
  @language
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/smi/module.rb', line 4

def name
  @name
end

#organizationObject

Returns the value of attribute organization.



4
5
6
# File 'lib/smi/module.rb', line 4

def organization
  @organization
end

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/smi/module.rb', line 4

def path
  @path
end

#referenceObject

Returns the value of attribute reference.



4
5
6
# File 'lib/smi/module.rb', line 4

def reference
  @reference
end

#structObject

Returns the value of attribute struct.



4
5
6
# File 'lib/smi/module.rb', line 4

def struct
  @struct
end

Class Method Details

.get_module(m) ⇒ Object



7
8
9
10
# File 'lib/smi/module.rb', line 7

def get_module(m)
  ptr = Smi::Wrapper.smiGetModule(m)
  new(ptr)
end

.get_modulesObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/smi/module.rb', line 11

def get_modules
  ptr = Smi::Wrapper.smiGetFirstModule
  m = self.new(ptr)
  modules = [m]
  while ptr = Smi::Wrapper::smiGetNextModule(ptr)
    break if ptr.pointer.null?
    modules << new(ptr)
  end
  modules
end

Instance Method Details

#get_nodes(nodekind = Wrapper::SMI_NODEKIND_NODE) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/smi/module.rb', line 27

def get_nodes(nodekind = Wrapper::SMI_NODEKIND_NODE)
  ptr = Wrapper.smiGetFirstNode(@struct.pointer, nodekind)
  n = Smi::Node.new(ptr)
  nodes = [n]
  while ptr = Smi::Wrapper::smiGetNextNode(ptr.pointer, nodekind)
    break if ptr.pointer.null?
    nodes << Smi::Node.new(ptr)
  end
  nodes
end