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