class YARD::MRuby::CodeObjects::FunctionObject

A FunctionObject represents a MRuby C API function declaration inside a header inside an include directory

Constants

ParameterType

Attributes

parameters[RW]

Returns the list of parameters parsed out of the method signature with their default values.

@return [Array<Array(String, String)>] a list of parameter names followed

by their default values (or nil)

Public Class Methods

new(header, name, &block) click to toggle source
Calls superclass method
# File lib/yard/mruby/code_objects/function_object.rb, line 14
def initialize(header, name, &block)
  super
end

Public Instance Methods

aliases() click to toggle source

Returns all alias names of the object @return [Array<Symbol>] the alias names

# File lib/yard/mruby/code_objects/function_object.rb, line 62
def aliases
  list = []
  return list unless namespace.is_a?(HeaderObject)
  namespace.aliases.each do |o, aname|
    list << o if aname == name && o.scope == scope
  end
  list
end
attr_info() click to toggle source
# File lib/yard/mruby/code_objects/function_object.rb, line 18
def attr_info
  nil
end
parameter_types() click to toggle source
# File lib/yard/mruby/code_objects/function_object.rb, line 43
def parameter_types
  @parameter_types || []
end
parse_parameter_types(parameters) click to toggle source
# File lib/yard/mruby/code_objects/function_object.rb, line 47
def parse_parameter_types(parameters)
  @parameter_types = []
  return if parameters.match /^\s*void\s*$/

  parameters.split(',').each do |parameter|
    parameter.scan(/((?:const\s+)?(?:struct\s+)?(?:\w+|\.\.\.)(?:\s*\*)?)\s*(\w+)?/) do |type,name|
      @parameter_types << ParameterType.new(type,name)
    end
  end

end
return_type() click to toggle source
# File lib/yard/mruby/code_objects/function_object.rb, line 26
def return_type
  @return_type
end
return_type=(type) click to toggle source
# File lib/yard/mruby/code_objects/function_object.rb, line 30
def return_type=(type)
  @return_type = (type == 'void' ? nil : type)
end
scope() click to toggle source
# File lib/yard/mruby/code_objects/function_object.rb, line 22
def scope
  ''
end