<commit_before>use Value;

use util;
use ffi;
use libc;

struct Method {
    name: String,
    func: *mut extern fn() -> Value,
    arg_count: i8,
}

struct Constant(String, Value);

struct Alias {
    new_name: String,
    original_name: String,
}

struct Accessor {
    name: String,
    reader: bool,
    writer: bool,
}

/// A class builder.
pub struct Class
{
    name: String,
    base_class: Value,
    parent: Option<Value>,

    methods: Vec<Method>,
    singleton_methods: Vec<Method>,

    included_modules: Vec<Value>,
    prepended_modules: Vec<Value>,
    constants: Vec<Constant>,
    aliases: Vec<Alias>,
    accessors: Vec<Accessor>,
}

impl Class {
    pub fn new<S>(name: S) -> Self where S: Into<String> {
        Self::new_under(name, None)
    }

    pub fn new_under<S>(name: S, parent: Option<Value>) -> Self where S: Into<String> {
        Class {
            name: name.into(),
            base_class: ffi::rb_cObject.into(),
            parent: parent,

            methods: Vec::new(),
            singleton_methods: Vec::new(),

            included_modules: Vec::new(),
            prepended_modules: Vec::new(),
            constants: Vec::new(),
            aliases: Vec::new(),
            accessors: Vec::new(),
        }<commit_msg>Wrap C FFI constant in unsafe<commit_after>use Value;

use util;
use ffi;
use libc;

struct Method {
    name: String,
    func: *mut extern fn() -> Value,
    arg_count: i8,
}

struct Constant(String, Value);

struct Alias {
    new_name: String,
    original_name: String,
}

struct Accessor {
    name: String,
    reader: bool,
    writer: bool,
}

/// A class builder.
pub struct Class
{
    name: String,
    base_class: Value,
    parent: Option<Value>,

    methods: Vec<Method>,
    singleton_methods: Vec<Method>,

    included_modules: Vec<Value>,
    prepended_modules: Vec<Value>,
    constants: Vec<Constant>,
    aliases: Vec<Alias>,
    accessors: Vec<Accessor>,
}

impl Class {
    pub fn new<S>(name: S) -> Self where S: Into<String> {
        Self::new_under(name, None)
    }

    pub fn new_under<S>(name: S, parent: Option<Value>) -> Self where S: Into<String> {
        Class {
            name: name.into(),
            base_class: unsafe { ffi::rb_cObject.into() },
            parent: parent,

            methods: Vec::new(),
            singleton_methods: Vec::new(),

            included_modules: Vec::new(),
            prepended_modules: Vec::new(),
            constants: Vec::new(),
            aliases: Vec::new(),
            accessors: Vec::new(),
        }
{'fraction_non_alphanumeric': 0.13432253026161656, 'fraction_numerical': 0.0007809449433814916, 'mean_word_length': 2.411451398135819, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1835818', 'n_tokens_mistral': 818, 'n_tokens_neox': 804, 'n_words': 216}