Class: Rbind::GeneratorC::ConversionsHelper

Inherits:
HelperBase
  • Object
show all
Defined in:
lib/rbind/generator_c.rb

Instance Attribute Summary

Attributes inherited from HelperBase

#includes, #name

Instance Method Summary collapse

Methods inherited from HelperBase

#binding, #wrap_includes

Constructor Details

#initialize(name, root) ⇒ ConversionsHelper

Returns a new instance of ConversionsHelper.



127
128
129
130
# File 'lib/rbind/generator_c.rb', line 127

def initialize(name,root)
    super
    @type_conversion = ERB.new(File.open(File.join(File.dirname(__FILE__),"templates","c","type_conversion.cc")).read,nil,'-')
end

Instance Method Details

#type_conversion(t) ⇒ Object



132
133
134
# File 'lib/rbind/generator_c.rb', line 132

def type_conversion(t)
    @type_conversion.result(t.binding)
end

#wrap_conversionsObject



136
137
138
139
140
141
142
143
# File 'lib/rbind/generator_c.rb', line 136

def wrap_conversions
    str = ""
    @root.each_type do |type|
        next if type.basic_type?
        str += type_conversion(type)
    end
    str
end