Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit keys from state and event meta hashes passed to draw methods #245

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/workflow/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ def condition_applicable?(object, event_arguments)
end

def draw(graph, from_state)
graph.add_edges(from_state.name.to_s, transitions_to.to_s, meta.merge(:label => to_s))
edgesattrs = GraphViz::Constants::EDGESATTRS.keys.map(&:to_sym)

defaults = { label: to_s }

graph.add_edges(from_state.name.to_s, transitions_to.to_s, defaults.merge(meta.slice(*edgesattrs)))
end

def to_s
Expand Down
4 changes: 3 additions & 1 deletion lib/workflow/state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def draw(graph)
:shape => 'ellipse'
}

node = graph.add_nodes(to_s, defaults.merge(meta))
nodesattrs = GraphViz::Constants::NODESATTRS.keys.map(&:to_sym)

node = graph.add_nodes(to_s, defaults.merge(meta.slice(*nodesattrs)))

# Add open arrow for initial state
# graph.add_edge(graph.add_node('starting_state', :shape => 'point'), node) if initial?
Expand Down