Macro ruby_code_to

Source
ruby_code_to!() { /* proc-macro */ }
Expand description

Execute Ruby code and return a different type

§Arguments

  • type - The return type of the ruby code
  • input - A &str literal containing ruby code

§Example

use macro_ruby::ruby_code_to;

let my_int = ruby_code_to!(i32, "print 500+500");
assert_eq!(my_int, 1000);

§List of supported types

i8, i16, i32, i64, i128, u8, u16, u32 u64, u128, usize, f32, f64, char, bool

§Note

If your type isn’t supported you may use ruby_code_ast!;