pub fn build_ruby_obligations(
file: &str,
source: &[u8],
next_probe: &mut u64,
) -> Result<RubyFileObligations, RubyInstrumenterError>Expand description
Build the complete obligation manifest and probe plan for one Ruby file.
next_probe numbers probes uniquely across the whole project.
Examples found in repository?
examples/ruby_plan.rs (line 20)
13fn main() {
14 let mut output = BTreeMap::new();
15 let mut probe = 0u64;
16 for path in std::env::args().skip(1) {
17 let Ok(source) = fs::read(&path) else {
18 continue;
19 };
20 match build_ruby_obligations(&path, &source, &mut probe) {
21 Ok(obligations) => {
22 output.insert(path, serde_json::to_value(obligations.plan).unwrap());
23 }
24 Err(error) => {
25 output.insert(path, serde_json::json!({ "parseError": error.to_string() }));
26 }
27 }
28 }
29 println!("{}", serde_json::to_string(&output).unwrap());
30}