module Anyolite

Overview

Main wrapper module, which should be covering most of the use cases.

Defined in:

Macro.cr
Main.cr
RbCast.cr
RbClass.cr
RbClassCache.cr
RbInterpreter.cr
RbModule.cr
RbRefTable.cr
RbTypeCache.cr
implementations/Mrb3Impl.cr
macros/ArgConversions.cr
macros/ArgTuples.cr
macros/FormatString.cr
macros/FunctionCalls.cr
macros/FunctionGenerators.cr
macros/ObjectAllocations.cr
macros/RubyConversions.cr
macros/RubyTypes.cr
macros/UnionCasts.cr
macros/WrapAll.cr
macros/WrapMethodIndex.cr
macros/Wrappers.cr

Constant Summary

Undef = Undefined.new

Undefined mruby value.

Macro Summary

Macro Detail

macro wrap(rb_interpreter, crystal_module_or_class, under = nil, instance_method_exclusions = [] of String | Symbol, class_method_exclusions = [] of String | Symbol, constant_exclusions = [] of String | Symbol, verbose = false) #

Wraps a whole class or module structure under a module into mruby.

The class or module crystal_module_or_class will be integrated into the RbInterpreter rb_interpreter, with the optional parent module under. Methods or constants to be excluded can be specified as Symbol or String in the Array class_method_exclusions (for class methods) or constant_exclusions (for constants). If verbose is set, wrapping information will be displayed.


[View source]
macro wrap_class(rb_interpreter, crystal_class, name, under = nil, superclass = nil) #

Wraps a Crystal class directly into an mruby class.

The Crystal Class crystal_class will be integrated into the RbInterpreter rb_interpreter, with name as its new designation, returning an Anyolite::RbClass.

To inherit from another mruby class, specify an Anyolite::RbClass as a superclass.

Each class can be defined in a specifiy module by setting under to a Anyolite::RbModule.


[View source]
macro wrap_class_method(rb_interpreter, crystal_class, name, proc, proc_args = nil, operator = "", context = nil, return_nil = false) #

Wraps a class method into mruby.

The class method proc of the Crystal Class crystal_class will be integrated into the RbInterpreter rb_interpreter, with the arguments proc_args as an Array of Class.

Its new name will be name.

The value operator will append the specified String to the final name and context can give the function a Path for resolving types correctly. The value return_nil will override any returned value with nil.


[View source]
macro wrap_class_method_with_keywords(rb_interpreter, crystal_class, name, proc, keyword_args, regular_args = nil, operator = "", context = nil, return_nil = false) #

Wraps a class method into mruby, using keyword arguments.

The class method proc of the Crystal Class crystal_class will be integrated into the RbInterpreter rb_interpreter, with the arguments regular_args as an Array of Class and keyword_args as an Array of TypeDeclaration.

Its new name will be name.

The value operator will append the specified String to the final name and context can give the function a Path for resolving types correctly. The value return_nil will override any returned value with nil.


[View source]
macro wrap_class_with_methods(rb_interpreter, crystal_class, under = nil, instance_method_exclusions = [] of String | Symbol, class_method_exclusions = [] of String | Symbol, constant_exclusions = [] of String | Symbol, use_enum_constructor = false, verbose = false) #

Wraps a whole class structure under a module into mruby.

The Class crystal_class will be integrated into the RbInterpreter rb_interpreter, with the optional parent module under. Methods or constants to be excluded can be specified as Symbol or String in the Array instance_method_exclusions (for instance methods), class_method_exclusions (for class methods) or constant_exclusions (for constants). Enum classes can be wrapped by setting use_enum_constructor. If verbose is set, wrapping information will be displayed.


[View source]
macro wrap_constant(rb_interpreter, under_module, name, crystal_value) #

Wraps a constant value under a module into mruby.

The value crystal_value will be integrated into the RbInterpreter rb_interpreter, with the name name and the parent module under_module.


[View source]
macro wrap_constant_under_class(rb_interpreter, under_class, name, crystal_value) #

Wraps a constant value under a class into mruby.

The value crystal_value will be integrated into the RbInterpreter rb_interpreter, with the name name and the parent Class under_class.


[View source]
macro wrap_constructor(rb_interpreter, crystal_class, proc_args = nil, operator = "", context = nil) #

Wraps the constructor of a Crystal class into mruby.

The constructor for the Crystal Class crystal_class will be integrated into the RbInterpreter rb_interpreter, with the arguments proc_args as an Array of Class.

The value operator will append the specified String to the final name and context can give the function a Path for resolving types correctly.


[View source]
macro wrap_constructor_with_keywords(rb_interpreter, crystal_class, keyword_args, regular_args = nil, operator = "", context = nil) #

Wraps the constructor of a Crystal class into mruby, using keyword arguments.

The constructor for the Crystal Class crystal_class will be integrated into the RbInterpreter rb_interpreter, with the arguments regular_args as an Array of Class and keyword_args as an Array of TypeDeclaration.

The value operator will append the specified String to the final name and context can give the function a Path for resolving types correctly.


[View source]
macro wrap_getter(rb_interpreter, crystal_class, name, proc, operator = "", context = nil) #

Wraps a getter into mruby.

The getter proc of the Crystal Class crystal_class will be integrated into the RbInterpreter rb_interpreter.

Its new name will be name.

The value operator will append the specified String to the final name and context can give the function a Path for resolving types correctly.


[View source]
macro wrap_instance_method(rb_interpreter, crystal_class, name, proc, proc_args = nil, operator = "", context = nil, return_nil = false) #

Wraps an instance method into mruby.

The instance method proc of the Crystal Class crystal_class will be integrated into the RbInterpreter rb_interpreter, with the arguments proc_args as an Array of Class.

Its new name will be name.

The value operator will append the specified String to the final name and context can give the function a Path for resolving types correctly. The value return_nil will override any returned value with nil.


[View source]
macro wrap_instance_method_with_keywords(rb_interpreter, crystal_class, name, proc, keyword_args, regular_args = nil, operator = "", context = nil, return_nil = false) #

Wraps an instance method into mruby, using keyword arguments.

The instance method proc of the Crystal Class crystal_class will be integrated into the RbInterpreter rb_interpreter, with the arguments regular_args as an Array of Class and keyword_args as an Array of TypeDeclaration.

Its new name will be name.

The value operator will append the specified String to the final name and context can give the function a Path for resolving types correctly. The value return_nil will override any returned value with nil.


[View source]
macro wrap_module(rb_interpreter, crystal_module, name, under = nil) #

Wraps a Crystal module into an mruby module.

The module crystal_module will be integrated into the RbInterpreter rb_interpreter, with name as its new designation, returning an Anyolite::RbModule.

The parent module can be specified with the module argument under.


[View source]
macro wrap_module_function(rb_interpreter, under_module, name, proc, proc_args = nil, operator = "", context = nil, return_nil = false) #

Wraps a module function into mruby.

The function proc under the module under_module will be integrated into the RbInterpreter rb_interpreter, with the arguments proc_args as an Array of Class.

Its new name will be name.

The value operator will append the specified String to the final name and context can give the function a Path for resolving types correctly. The value return_nil will override any returned value with nil.


[View source]
macro wrap_module_function_with_keywords(rb_interpreter, under_module, name, proc, keyword_args, regular_args = nil, operator = "", context = nil, return_nil = false) #

Wraps a module function into mruby, using keyword arguments.

The function proc under the module under_module will be integrated into the RbInterpreter rb_interpreter, with the arguments regular_args as an Array of Class and keyword_args as an Array of TypeDeclaration.

Its new name will be name.

The value operator will append the specified String to the final name and context can give the function a Path for resolving types correctly. The value return_nil will override any returned value with nil.


[View source]
macro wrap_module_with_methods(rb_interpreter, crystal_module, under = nil, class_method_exclusions = [] of String | Symbol, constant_exclusions = [] of String | Symbol, verbose = false) #

Wraps a whole module structure under a module into mruby.

The module crystal_module will be integrated into the RbInterpreter rb_interpreter, with the optional parent module under. Methods or constants to be excluded can be specified as Symbol or String in the Array class_method_exclusions (for class methods) or constant_exclusions (for constants). If verbose is set, wrapping information will be displayed.


[View source]
macro wrap_property(rb_interpreter, crystal_class, name, proc, proc_arg, operator_getter = "", operator_setter = "=", context = nil) #

Wraps a property into mruby.

The property proc of the Crystal Class crystal_class will be integrated into the RbInterpreter rb_interpreter, with the argument proc_arg as its respective Class.

Its new name will be name.

The values operator_getter and operator_setter will append the specified String to the final names and context can give the function a Path for resolving types correctly.


[View source]
macro wrap_setter(rb_interpreter, crystal_class, name, proc, proc_arg, operator = "=", context = nil) #

Wraps a setter into mruby.

The setter proc (without the =) of the Crystal Class crystal_class will be integrated into the RbInterpreter rb_interpreter, with the argument proc_arg as its respective Class.

Its new name will be name.

The value operator will append the specified String to the final name and context can give the function a Path for resolving types correctly.


[View source]