class RbPlusPlus::Builders::ModuleNode
Handles code generation dealing with user-defined modules.
Attributes
modules[RW]
And needs to specially handle any other nexted modules
name[RW]
Has a name
Public Class Methods
new(code, parent = nil)
click to toggle source
Node is the RbModule
object, it proxies any unknown calls off to it's internal Node object
Calls superclass method
RbPlusPlus::Builders::Base::new
# File lib/rbplusplus/builders/module.rb, line 18 def initialize(code, parent = nil) super @name ||= code.name @modules ||= code.modules end
Public Instance Methods
build()
click to toggle source
# File lib/rbplusplus/builders/module.rb, line 29 def build with_modules add_child IncludeNode.new(self, "rice/Module.hpp", :system) # Make sure we ignore anything from the :: namespace if self.code && self.code.name != "::" with_module_functions with_enumerations with_classes end nodes.flatten! self.rice_variable_type = "Rice::Module" self.rice_variable = "rb_m#{self.qualified_name.as_variable}" end
qualified_name()
click to toggle source
# File lib/rbplusplus/builders/module.rb, line 25 def qualified_name self.code.qualified_name end
write()
click to toggle source
# File lib/rbplusplus/builders/module.rb, line 47 def write prefix = "\t#{rice_variable_type} #{rice_variable} = " if parent.rice_variable registrations << "#{prefix} Rice::define_module_under(#{parent.rice_variable}, \"#{@name}\");" else registrations << "#{prefix} Rice::define_module(\"#{@name}\");" end end