Class: Derketo::Serializers::Mermaid

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/derketo/serializers/mermaid.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#clean, write

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

#textObject

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

#serializeObject



21
22
23
# File 'lib/derketo/serializers/mermaid.rb', line 21

def serialize
  @text
end