module MrbWrap
Overview
Main wrapper module, which should be covering most of the use cases.
Defined in:
MrbWrap.crConstant Summary
-
Undef =
Undefined.new
-
Undefined mruby value.
Macro Summary
-
wrap(mrb_state, 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.
-
wrap_class(mrb_state, crystal_class, name, under = nil, superclass = nil)
Wraps a Crystal class directly into an mruby class.
-
wrap_class_method(mrb_state, crystal_class, name, proc, proc_args = [] of Class, operator = "", context = nil)
Wraps a class method into mruby.
-
wrap_class_method_with_keywords(mrb_state, crystal_class, name, proc, keyword_args, regular_args = [] of Class, operator = "", context = nil)
Wraps a class method into mruby, using keyword arguments.
-
wrap_class_with_methods(mrb_state, 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.
-
wrap_constant(mrb_state, under_module, name, crystal_value)
Wraps a constant value under a module into mruby.
-
wrap_constant_under_class(mrb_state, under_class, name, crystal_value)
Wraps a constant value under a class into mruby.
-
wrap_constructor(mrb_state, crystal_class, proc_args = [] of Class, operator = "", context = nil)
Wraps the constructor of a Crystal class into mruby.
-
wrap_constructor_with_keywords(mrb_state, crystal_class, keyword_args, regular_args = [] of Class, operator = "", context = nil)
Wraps the constructor of a Crystal class into mruby, using keyword arguments.
-
wrap_getter(mrb_state, crystal_class, name, proc, operator = "", context = nil)
Wraps a getter into mruby.
-
wrap_instance_method(mrb_state, crystal_class, name, proc, proc_args = [] of Class, operator = "", context = nil)
Wraps an instance method into mruby.
-
wrap_instance_method_with_keywords(mrb_state, crystal_class, name, proc, keyword_args, regular_args = [] of Class, operator = "", context = nil)
Wraps an instance method into mruby, using keyword arguments.
-
wrap_module(mrb_state, crystal_module, name, under = nil)
Wraps a Crystal module into an mruby module.
-
wrap_module_function(mrb_state, under_module, name, proc, proc_args = [] of Class, operator = "", context = nil)
Wraps a module function into mruby.
-
wrap_module_function_with_keywords(mrb_state, under_module, name, proc, keyword_args, regular_args = [] of Class, operator = "", context = nil)
Wraps a module function into mruby, using keyword arguments.
-
wrap_module_with_methods(mrb_state, 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.
-
wrap_property(mrb_state, crystal_class, name, proc, proc_arg, operator_getter = "", operator_setter = "=", context = nil)
Wraps a property into mruby.
-
wrap_setter(mrb_state, crystal_class, name, proc, proc_arg, operator = "=", context = nil)
Wraps a setter into mruby.
Macro Detail
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 MrbState
mrb_state,
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.
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
.
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.
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.
Wraps a whole class structure under a module into mruby.
The Class
crystal_class will be integrated into the MrbState
mrb_state,
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.
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.
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.
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
.
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
.
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.
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.
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.
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.
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.
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.
Wraps a whole module structure under a module into mruby.
The module crystal_module will be integrated into the MrbState
mrb_state,
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.
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.
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.