Class: AutoC::Composite::Method

Inherits:
Function
  • Object
show all
Defined in:
lib/autoc/composite.rb

Overview

Type-bound C side function

Constant Summary

Constants included from Entity

Entity::ReferenceSet

Instance Attribute Summary collapse

Attributes inherited from Function

#inline, #name, #parameters, #result, #visibility

Instance Method Summary collapse

Methods inherited from Function

#abstract?, #call, #code, #configure, #definition, #external_code, #header, #inline?, #inline_code, #inspect, #internal?, #live?, #parameter, #private?, #prototype, #public?, #signature, #to_s, #variadic?

Methods included from Entity

#<=>, #complexity, #dependencies, #forward_declarations, #implementation, #interface, #position, #references, #total_dependencies, #total_references

Constructor Details

#initialize(type, result, name, parameters, **kws) ⇒ Method

Returns a new instance of Method.



278
279
280
281
282
283
# File 'lib/autoc/composite.rb', line 278

def initialize(type, result, name, parameters, **kws)
  @type = type
  super(result.to_value, self.type.identifier(name), parameters, **kws)
  dependencies << self.type << self.result.to_type
  # TODO register parameters' types as dependencies
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object



285
286
287
288
289
290
# File 'lib/autoc/composite.rb', line 285

def method_missing(meth, *args) 
  if parameters.has_key?(meth) then parameters[meth]
  elsif type.respond_to?(meth) then type.send(meth, *args)
  else meth
  end
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



276
277
278
# File 'lib/autoc/composite.rb', line 276

def type
  @type
end