Sha256: 96671e3404e32455dfe7dfb7ab0a0b3ded8dc4175830ae15c174a6556eb67f03
Contents?: true
Size: 493 Bytes
Versions: 4
Compression:
Stored size: 493 Bytes
Contents
use magnus::{prelude::*, Value}; #[test] fn it_can_call_method_with_block() { let ruby = unsafe { magnus::embed::init() }; let ary = ruby.ary_new_from_values(&[ ruby.into_value(1_i64), ruby.into_value(2_i64), ruby.into_value(3_i64), ]); let _: Value = ary .block_call("map!", (), |_, args, _| { i64::try_convert(args[0]).map(|i| i * 4) }) .unwrap(); assert_eq!(ary.to_vec::<i64>().unwrap(), vec![4, 8, 12]); }
Version data entries
4 entries across 4 versions & 1 rubygems