packs/packs/parsing/ruby/
rails_utils.rs1use std::{collections::HashSet, path::Path};
2
3use regex::Regex;
4
5pub(crate) fn get_acronyms_from_disk(
11 inflections_path: &Path,
12) -> HashSet<String> {
13 let mut acronyms: HashSet<String> = HashSet::new();
14
15 if inflections_path.exists() {
16 let inflections_file =
17 std::fs::read_to_string(inflections_path).unwrap();
18 let inflections_lines = inflections_file.lines();
19 for line in inflections_lines {
20 if line.contains(".acronym") {
21 let re = Regex::new(r#"['\\"]"#).unwrap();
22 let acronym = re.split(line).nth(1).unwrap();
23 acronyms.insert(acronym.to_string());
24 }
25 }
26 }
27
28 acronyms
29}