问题描述
所以我想创建一个类似于 VCR 的 gem 开始记录方法调用连同这些方法所在的类,甚至可能是行号,并停止记录并生成一个 yml 文件或其他实际上是运行的 UML 序列图元数据描述的内容.
进一步扩展,我想使用美人鱼宝石来实际吐出一张图片 UML 图.
我正在考虑采用这篇 reddit 帖子中概述的方法,基本上是存储一组哈希值以解析为下游的某种植物文本.
So I want to create a gem similar to VCR that starts recording method callsalong with the classes those methods are in, maybe even line number, and stop recording and generate say a yml file or something which is effectively a UML sequence diagram metadata description of the run.
Extending that even further, I want to use the mermaid gem to actually spit out a picture UML diagram.
I'm thinking of taking the approach outlined in this reddit post, basically storing a array of hashes to parse into some kind of Plant text downstream.https://www.reddit.com/r/ruby/comments/11ns2l/does_a_uml_sequence_diagram_generation_gem_exist/
http://phrogz.net/ProgrammingRuby/ospace.html#tracingyourprogramsexecution
Anyways, finally, my question is... Is there a better way to approach this?Or should I just kind of follow the idea proposed in the reddit?
A simplest solution would be to generate a plant uml file. A Plant file is far simpler than an XMI file and Plant is integrated in a lot's of tool.
It could be an alternative.
For example:
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml
produces:
这篇关于创建序列图生成器 ruby gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!