module MrbWrap

Overview

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

Defined in:

MrbWrap.cr

Constant Summary

Undef = Undefined.new

Undefined mruby value

Macro Summary

Macro Detail

macro wrap_class(mrb_state, 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 MrbState mrb_state, with name as its new designation, returning an MrbClass.

To inherit from another mruby class, specify an MrbClass as a superclass.

Each class can be defined in a specifiy module by setting under to a MrbModule.


[View source]
macro wrap_class_method(mrb_state, crystal_class, name, proc, proc_args = [] of Class, operator = "") #

Wraps a class method into mruby.

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

Its new name will be name.


[View source]
macro wrap_class_method_with_keywords(mrb_state, crystal_class, name, proc, keyword_args, regular_args = [] of Class, operator = "") #

Wraps a class method into mruby, using keyword arguments.

The class method proc of the Crystal Class crystal_class will be integrated into the MrbState mrb_state, with the arguments regular_args as an Array of Class and keyword_args as a Hash of Symbol => Class. Alternatively, a Tuple with the Class and a default value for the Class can be used instead of the Class.

Its new name will be name.


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

Wraps a constant value under a module into mruby.

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


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

Wraps a constant value under a class into mruby.

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


[View source]
macro wrap_constructor(mrb_state, crystal_class, proc_args = [] of Class, operator = "") #

Wraps the constructor of a Crystal class into mruby.

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


[View source]
macro wrap_constructor_with_keywords(mrb_state, crystal_class, keyword_args, regular_args = [] of Class, operator = "") #

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 MrbState mrb_state, with the arguments regular_args as an Array of Class and keyword_args as a Hash of Symbol => Class. Alternatively, a Tuple with the Class and a default value for the Class can be used instead of the Class.


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

Wraps a getter into mruby.

The getter proc of the Crystal Class crystal_class will be integrated into the MrbState mrb_state.

Its new name will be name.


[View source]
macro wrap_instance_method(mrb_state, crystal_class, name, proc, proc_args = [] of Class, operator = "") #

Wraps an instance method into mruby.

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

Its new name will be name.


[View source]
macro wrap_instance_method_with_keywords(mrb_state, crystal_class, name, proc, keyword_args, regular_args = [] of Class, operator = "") #

Wraps an instance method into mruby, using keyword arguments.

The instance method proc of the Crystal Class crystal_class will be integrated into the MrbState mrb_state, with the arguments regular_args as an Array of Class and keyword_args as a Hash of Symbol => Class. Alternatively, a Tuple with the Class and a default value for the Class can be used instead of the Class.

Its new name will be name.


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

Wraps a Crystal module into an mruby module.

The module crystal_module will be integrated into the MrbState mrb_state, with name as its new designation, returning an MrbModule.

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


[View source]
macro wrap_module_function(mrb_state, under_module, name, proc, proc_args = [] of Class, operator = "") #

Wraps a module function into mruby.

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

Its new name will be name.


[View source]
macro wrap_module_function_with_keywords(mrb_state, under_module, name, proc, keyword_args, regular_args = [] of Class, operator = "") #

Wraps a module function into mruby, using keyword arguments.

The function proc under the module under_module will be integrated into the MrbState mrb_state, with the arguments regular_args as an Array of Class and keyword_args as a Hash of Symbol => Class. Alternatively, a Tuple with the Class and a default value for the Class can be used instead of the Class.

Its new name will be name.


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

Wraps a property into mruby.

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

Its new name will be name.


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

Wraps a setter into mruby.

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

Its new name will be name.


[View source]