method
visualizer
v7.0.0 -
Show latest stable
-
0 notes -
Class: TransitionTable
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
visualizer(paths, title = "FSM")
public
Hide source
# File actionpack/lib/action_dispatch/journey/gtg/transition_table.rb, line 125 def visualizer(paths, title = "FSM") viz_dir = File.join __dir__, "..", "visualizer" fsm_js = File.read File.join(viz_dir, "fsm.js") fsm_css = File.read File.join(viz_dir, "fsm.css") erb = File.read File.join(viz_dir, "index.html.erb") states = "function tt() { return #{to_json}; }" fun_routes = paths.sample(3).map do |ast| ast.filter_map { |n| case n when Nodes::Symbol case n.left when ":id" then rand(100).to_s when ":format" then %{ xml json }.sample else "omg" end when Nodes::Terminal then n.symbol else nil end }.join end stylesheets = [fsm_css] svg = to_svg javascripts = [states, fsm_js] fun_routes = fun_routes stylesheets = stylesheets svg = svg javascripts = javascripts require "erb" template = ERB.new erb template.result(binding) end