Skip to content

Commit

Permalink
feat(uml): init convert code
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Feb 27, 2021
1 parent d67882f commit b1e6b8f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/coco_struct_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub mod cmd_ctags;
pub mod coco_struct;
pub mod ctags_opt;
pub mod ctags_parser;
pub mod plantuml_render;
pub mod struct_analysis;

pub struct CocoStructAnalysis {}
Expand Down
32 changes: 32 additions & 0 deletions plugins/coco_struct_analysis/src/plantuml_render.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use crate::coco_struct::ClassInfo;

pub trait PlantUml {
fn render(&self) -> String;
}

pub struct PlantUmlRender;

impl PlantUmlRender {
pub fn render(_classes: Vec<ClassInfo>) -> String {
let rendered: Vec<String> = vec![];
let dep: Vec<String> = vec![];

format!(
"@startuml\n\n{}\n{}\n@enduml",
rendered.join("\n\n"),
dep.join("\n\n")
)
}
}

#[cfg(test)]
mod tests {
use crate::plantuml_render::PlantUmlRender;

#[test]
fn should_render_empty() {
let classes = vec![];
let str = PlantUmlRender::render(classes);
assert_eq!("@startuml\n\n\n\n@enduml", str);
}
}

0 comments on commit b1e6b8f

Please sign in to comment.