diff --git a/Cargo.lock b/Cargo.lock index 2fcadaf..31f6f17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -658,8 +658,8 @@ dependencies = [ "crossterm", "mruby-compiler2-sys", "mrubyedge 1.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "mrubyedge-math 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mrubyedge-time 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "mrubyedge-math 0.1.1", + "mrubyedge-time 0.1.2", "nom", "rand", "syn", @@ -668,23 +668,23 @@ dependencies = [ [[package]] name = "mrubyedge-math" version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94ab341d1a13e87a66cde9725f0a2f15a2e88c806b7995d9eb69968f4162fa45" dependencies = [ - "mec-mrbc-sys", "mrubyedge 1.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mrubyedge-math" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ab341d1a13e87a66cde9725f0a2f15a2e88c806b7995d9eb69968f4162fa45" +version = "0.1.2" dependencies = [ + "mec-mrbc-sys", "mrubyedge 1.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mrubyedge-serde-json" -version = "0.1.1" +version = "0.1.2" dependencies = [ "mec-mrbc-sys", "mrubyedge 1.1.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -695,19 +695,19 @@ dependencies = [ [[package]] name = "mrubyedge-time" version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143c9c3b434a5c16e206d2cb18917f8b6a8e035259b01029a2c7f9196a9642ec" dependencies = [ "libc", - "mec-mrbc-sys", "mrubyedge 1.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mrubyedge-time" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143c9c3b434a5c16e206d2cb18917f8b6a8e035259b01029a2c7f9196a9642ec" +version = "0.1.3" dependencies = [ "libc", + "mec-mrbc-sys", "mrubyedge 1.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/mruby-math/Cargo.toml b/mruby-math/Cargo.toml index f00378d..606e924 100644 --- a/mruby-math/Cargo.toml +++ b/mruby-math/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mrubyedge-math" -version = "0.1.1" +version = "0.1.2" edition = "2024" authors = ["Uchio Kondo "] description = "mruby-math provides Math module for mruby/edge" diff --git a/mruby-math/src/lib.rs b/mruby-math/src/lib.rs index 4a7d790..431a5da 100644 --- a/mruby-math/src/lib.rs +++ b/mruby-math/src/lib.rs @@ -10,6 +10,10 @@ use mrubyedge::{ }; pub fn init_math(vm: &mut VM) { + if vm.get_const_by_name("Math").is_some() { + return; + } + let math_module = vm.define_module("Math", None); // Define constants diff --git a/mruby-serde-json/Cargo.toml b/mruby-serde-json/Cargo.toml index 4c87cef..3fee489 100644 --- a/mruby-serde-json/Cargo.toml +++ b/mruby-serde-json/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mrubyedge-serde-json" -version = "0.1.1" +version = "0.1.2" edition = "2024" authors = ["Uchio Kondo "] description = "mruby-serde-json provides JSON serialization/deserialization for mruby/edge using serde_json" diff --git a/mruby-serde-json/src/lib.rs b/mruby-serde-json/src/lib.rs index c8cb96d..448c713 100644 --- a/mruby-serde-json/src/lib.rs +++ b/mruby-serde-json/src/lib.rs @@ -8,6 +8,10 @@ use mrubyedge::{ }; pub fn init_json(vm: &mut VM) { + if vm.get_const_by_name("JSON").is_some() { + return; + } + let json_class = vm.define_class("JSON", None, None); mrb_define_class_cmethod( diff --git a/mruby-time/Cargo.toml b/mruby-time/Cargo.toml index 4e6956e..e054210 100644 --- a/mruby-time/Cargo.toml +++ b/mruby-time/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mrubyedge-time" -version = "0.1.2" +version = "0.1.3" edition = "2024" authors = ["Uchio Kondo "] description = "mruby-time provides Time class for mruby/edge" diff --git a/mruby-time/src/lib.rs b/mruby-time/src/lib.rs index 1977a26..0e0cf2d 100644 --- a/mruby-time/src/lib.rs +++ b/mruby-time/src/lib.rs @@ -475,6 +475,10 @@ fn float_to_sec_nsec(obj: &RObject) -> Result<(i64, u32), Error> { /// Initialize the Time class in the VM. /// Call this after `VM::open` to make `Time` available in Ruby code. pub fn init_time(vm: &mut VM) { + if vm.get_const_by_name("Time").is_some() { + return; + } + let time_class = vm.define_class("Time", None, None); // Class methods