module Journeyviz::Graphable
Public Instance Methods
graph()
click to toggle source
# File lib/journeyviz/graphable.rb, line 11 def graph defs = [ *graph_screens, *graph_blocks, *graph_inputs, *graph_outputs, *graph_transitions, *graph_styles ].join("\n") "graph LR\n#{defs}" end
Private Instance Methods
action_id(node)
click to toggle source
# File lib/journeyviz/graphable.rb, line 58 def action_id(node) from_id = graph_id(node.screen) to_id = graph_target(node) "transition_#{from_id}_#{node.name}_#{to_id}" end
block_id(node)
click to toggle source
# File lib/journeyviz/graphable.rb, line 54 def block_id(node) "block_#{node.full_qualifier.join('_')}" end
graph_blocks()
click to toggle source
# File lib/journeyviz/graphable.rb, line 30 def graph_blocks (@blocks || []).map { |block| "#{graph_id(block)}[#{block.name}]:::block" } end
graph_id(node)
click to toggle source
# File lib/journeyviz/graphable.rb, line 42 def graph_id(node) case node when Journeyviz::Screen then screen_id(node) when Journeyviz::Block then block_id(node) when Journeyviz::Action then action_id(node) end end
graph_screens()
click to toggle source
# File lib/journeyviz/graphable.rb, line 26 def graph_screens (@screens || []).map { |screen| "#{graph_id(screen)}[#{screen.name}]:::screen" } end
graph_styles()
click to toggle source
# File lib/journeyviz/graphable.rb, line 34 def graph_styles [ 'classDef screen fill:#373496,stroke:#373496,stroke-width:2px,color:#fff', 'classDef transition fill:#fff,stroke:#373496,stroke-width:2px,color:#373496,stroke-dasharray: 5, 5', 'classDef block fill:#963734,color:#fff' ] end
screen_id(node)
click to toggle source
# File lib/journeyviz/graphable.rb, line 50 def screen_id(node) "screen_#{node.full_qualifier.join('_')}" end