artichoke_backend/extn/core/trueclass/
mod.rs1use std::ffi::CStr;
2
3use crate::extn::prelude::*;
4
5const TRUE_CLASS_CSTR: &CStr = c"TrueClass";
6static TRUE_CLASS_RUBY_SOURCE: &[u8] = include_bytes!("trueclass.rb");
7
8pub fn init(interp: &mut Artichoke) -> InitializeResult<()> {
9 if interp.is_class_defined::<TrueClass>() {
10 return Ok(());
11 }
12
13 let spec = class::Spec::new("TrueClass", TRUE_CLASS_CSTR, None, None)?;
14 interp.def_class::<TrueClass>(spec)?;
15 interp.eval(TRUE_CLASS_RUBY_SOURCE)?;
16
17 Ok(())
18}
19
20#[derive(Debug, Clone, Copy)]
21pub struct TrueClass;