Class: FFI::Generator::Function

Inherits:
Type
  • Object
show all
Defined in:
lib/generator/function.rb

Direct Known Subclasses

Callback

Defined Under Namespace

Classes: Argument

Constant Summary

Constants inherited from Type

Type::ArrayRE, Type::ArraySizeRE

Instance Attribute Summary

Attributes inherited from Type

#full_decl

Attributes inherited from Node

#symname

Instance Method Summary collapse

Methods inherited from Node

#get_attr

Constructor Details

#initialize(params = { }) ⇒ Function

Returns a new instance of Function.



16
17
18
19
# File 'lib/generator/function.rb', line 16

def initialize(params = { })
  super
  @type = get_attr('type')
end

Instance Method Details

#to_sObject



20
21
22
23
24
25
# File 'lib/generator/function.rb', line 20

def to_s
  params = get_params(@node).inject([]) do |array, node|
    array << Argument.new(:node => node, :typedefs => @typedefs).to_s
  end
  @indent_str + "attach_function :#{@symname}, [ #{params.join(', ')} ], #{get_rtype}"
end