Function magnus::define_module

source ·
pub fn define_module(name: &str) -> Result<RModule, Error>
Expand description

Define a module in the root scope.

§Panics

Panics if called from a non-Ruby thread. See Ruby::define_module for the non-panicking version.

§Examples

use magnus::{define_module, rb_assert};

define_module("Example").unwrap();
rb_assert!("Example.is_a?(Module)");
rb_assert!("!Example.is_a?(Class)");