Class: Derketo::Serializers::Mermaid
- Inherits:
-
Object
- Object
- Derketo::Serializers::Mermaid
- Includes:
- Helpers
- Defined in:
- lib/derketo/serializers/mermaid.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(tracer) ⇒ Mermaid
constructor
A new instance of Mermaid.
- #participant(class_name) ⇒ Object
- #serialize ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(tracer) ⇒ Mermaid
Returns a new instance of Mermaid.
8 9 10 11 12 13 14 15 |
# File 'lib/derketo/serializers/mermaid.rb', line 8 def initialize(tracer) events = tracer.events.all @text = "sequenceDiagram\n" events.map(&:class_name).uniq.map do |class_name| @text << participant(class_name) end @text << events.map(&:to_mermaid).join end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
7 8 9 |
# File 'lib/derketo/serializers/mermaid.rb', line 7 def text @text end |
Instance Method Details
#participant(class_name) ⇒ Object
17 18 19 |
# File 'lib/derketo/serializers/mermaid.rb', line 17 def participant(class_name) "\tparticipant #{class_name}\n" end |
#serialize ⇒ Object
21 22 23 |
# File 'lib/derketo/serializers/mermaid.rb', line 21 def serialize @text end |