Macro ruby_file_str

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

Execute Ruby from a file and return a string

§Arguments

  • filepath - A &str literal containing the file path

§Example

Contents of ./src/main.rs

use macro_ruby::ruby_file_str;

let my_str = ruby_file_str!("src/file.rb");
assert_eq!(my_str, "hi\n");

Contents of ./src/file.rb:

puts "hi"

§Note

puts adds a trailing ‘\n’, use print if you don’t want that