Class: Rbind::GeneratorC::ConversionsHelper
- Inherits:
-
HelperBase
- Object
- HelperBase
- Rbind::GeneratorC::ConversionsHelper
- Defined in:
- lib/rbind/generator_c.rb
Instance Attribute Summary
Attributes inherited from HelperBase
#extern_types, #includes, #name
Instance Method Summary collapse
-
#initialize(name, root, extern_types) ⇒ ConversionsHelper
constructor
A new instance of ConversionsHelper.
- #type_conversion(t) ⇒ Object
- #wrap_conversions ⇒ Object
Methods inherited from HelperBase
Constructor Details
#initialize(name, root, extern_types) ⇒ ConversionsHelper
Returns a new instance of ConversionsHelper.
141 142 143 144 |
# File 'lib/rbind/generator_c.rb', line 141 def initialize(name,root,extern_types) 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
146 147 148 |
# File 'lib/rbind/generator_c.rb', line 146 def type_conversion(t) @type_conversion.result(t.binding) end |
#wrap_conversions ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/rbind/generator_c.rb', line 150 def wrap_conversions str = "" @extern_types.each do |type| next if type.basic_type? str += type_conversion(type) end @root.each_type do |type| next if type.basic_type? str += type_conversion(type) end str end |