Class: RbPlusPlus::Builders::IncludeNode

Inherits:
Base
  • Object
show all
Defined in:
lib/rbplusplus/builders/include.rb

Overview

Node for an #include line. Can be a :local (default) or :system include declaration.

Includes have no children

Instance Attribute Summary

Attributes inherited from Base

#code, #declarations, #global_nodes, #includes, #nodes, #parent, #registrations, #rice_variable, #rice_variable_type

Instance Method Summary collapse

Methods inherited from Base

#has_children?, #qualified_name, #sort

Constructor Details

#initialize(parent, path, type = :local) ⇒ IncludeNode

Returns a new instance of IncludeNode.



11
12
13
14
15
16
# File 'lib/rbplusplus/builders/include.rb', line 11

def initialize(parent, path, type = :local)
  super(nil, parent)

  @path = path
  @type = type
end

Instance Method Details

#buildObject



18
19
20
# File 'lib/rbplusplus/builders/include.rb', line 18

def build
  #nop
end

#writeObject



22
23
24
25
26
# File 'lib/rbplusplus/builders/include.rb', line 22

def write
  if @path
    includes << (@type == :local ? "#include \"#{@path}\"" : "#include <#{@path}>")
  end
end