Ruby support #1

Open
jaroslaw wants to merge 165 commits from ruby into main
2 changed files with 6 additions and 12 deletions
Showing only changes of commit 3962fc40b1 - Show all commits

View file

@ -7,27 +7,21 @@
use std::{ use std::{
collections::HashMap, collections::HashMap,
ffi::{c_void, CString},
sync::{Arc, Condvar, LazyLock, Mutex}, sync::{Arc, Condvar, LazyLock, Mutex},
thread::{self, JoinHandle}, thread::{self, JoinHandle},
}; };
use anyhow::anyhow;
use bevy::{ use bevy::{
asset::Asset, asset::Asset,
ecs::{ ecs::{component::Component, resource::Resource, schedule::ScheduleLabel},
component::Component, query::QueryParManyUniqueIter, resource::Resource,
schedule::ScheduleLabel,
},
reflect::TypePath, reflect::TypePath,
tasks::futures_lite::io, tasks::futures_lite::io,
}; };
use magnus::prelude::*;
use magnus::{ use magnus::{
block::Proc, data_type_builder, function, method::ReturnValue, try_convert, value::Lazy, block::Proc, data_type_builder, function, value::Lazy, DataType, DataTypeFunctions, IntoValue,
DataType, DataTypeFunctions, IntoValue, RClass, RObject, Ruby, TryConvert, TypedData, RClass, Ruby, TryConvert, TypedData,
}; };
use magnus::{prelude::*, rb_sys::FromRawValue};
use rb_sys::{rb_define_global_function, rb_scan_args, VALUE};
use serde::Deserialize; use serde::Deserialize;
use crate::{ use crate::{
@ -408,7 +402,7 @@ impl FuncArgs<'_, RubyValue, RubyRuntime> for () {
} }
impl<T: IntoValue> FuncArgs<'_, RubyValue, RubyRuntime> for Vec<T> { impl<T: IntoValue> FuncArgs<'_, RubyValue, RubyRuntime> for Vec<T> {
fn parse(self, engine: &magnus::Ruby) -> Vec<RubyValue> { fn parse(self, _engine: &magnus::Ruby) -> Vec<RubyValue> {
self.into_iter() self.into_iter()
.map(|x| RubyValue::new(x.into_value())) .map(|x| RubyValue::new(x.into_value()))
.collect() .collect()

View file

@ -457,7 +457,7 @@ mod lua_tests {
mod ruby_tests { mod ruby_tests {
use bevy::prelude::*; use bevy::prelude::*;
use bevy_scriptum::runtimes::ruby::{prelude::*, RubyScriptData}; use bevy_scriptum::runtimes::ruby::{prelude::*, RubyScriptData};
use magnus::{value::ReprValue, Module, Object}; use magnus::value::ReprValue;
impl AssertStateKeyValue for RubyRuntime { impl AssertStateKeyValue for RubyRuntime {
type ScriptData = RubyScriptData; type ScriptData = RubyScriptData;