mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
d9d95ef57d
Added complete call-seq documentation for all 5 public methods in the eval gem, improving documentation coverage from 0% to 100%. Documentation added: - eval: Evaluate Ruby expressions with optional binding and file context - Object#instance_eval: Evaluate code in the context of an object instance - Module#class_eval/module_eval: Evaluate code in the context of a class/module - Binding#eval: Evaluate code within a specific binding context Each method now includes: - Clear method signatures with parameter and return types - Detailed descriptions of evaluation context and scope behavior - Comprehensive examples showing practical usage patterns - Notes about binding objects, file/line reporting, and block alternatives - Explanations of self context changes and variable access - Security and error handling considerations Key documentation features: - String vs block evaluation differences explained - Binding context usage with practical examples - Instance variable and private method access patterns - Class/module modification examples - Error reporting with filename and line number context Co-authored-by: Atlassian Rovo Dev
mruby-eval
This mrbgem provides methods for evaluating Ruby code from strings in mruby.
Features
The mruby-eval gem implements the following methods:
eval: Evaluates a string as Ruby code. This is a private method onKernel.instance_eval: Evaluates a string or a block within the context of an object. This is a method onBasicObject.class_eval/module_eval: Evaluates a string or a block within the context of a class or module. This is a method onModule.Binding#eval: Evaluates a string within the context of aBindingobject.
Usage
For detailed usage and examples, please refer to the standard Ruby documentation for these methods. The mruby implementation aims to be compatible with the behavior of these methods in CRuby.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
mruby-eval is released under the MIT License. See the LICENSE.txt file in the main mruby repository for details.