@@ -210,7 +210,14 @@ def relationship_style(relationship)
210210 end
211211
212212 each_entity do |entity , attributes |
213- draw_node entity . name , entity_options ( entity , attributes )
213+ if options [ :cluster ] && entity . namespace
214+ cluster_name = "cluster_#{ entity . namespace } "
215+ cluster = graph . get_graph ( cluster_name ) ||
216+ graph . add_graph ( cluster_name , label : entity . namespace )
217+ draw_cluster_node cluster , entity . name , entity_options ( entity , attributes )
218+ else
219+ draw_node entity . name , entity_options ( entity , attributes )
220+ end
214221 end
215222
216223 each_specialization do |specialization |
@@ -233,15 +240,19 @@ def relationship_style(relationship)
233240 private
234241
235242 def node_exists? ( name )
236- !!graph . get_node ( escape_name ( name ) )
243+ !!graph . search_node ( escape_name ( name ) )
237244 end
238245
239246 def draw_node ( name , options )
240247 graph . add_nodes escape_name ( name ) , options
241248 end
242249
250+ def draw_cluster_node ( cluster , name , options )
251+ cluster . add_nodes escape_name ( name ) , options
252+ end
253+
243254 def draw_edge ( from , to , options )
244- graph . add_edges graph . get_node ( escape_name ( from ) ) , graph . get_node ( escape_name ( to ) ) , options if node_exists? ( from ) and node_exists? ( to )
255+ graph . add_edges graph . search_node ( escape_name ( from ) ) , graph . search_node ( escape_name ( to ) ) , options if node_exists? ( from ) and node_exists? ( to )
245256 end
246257
247258 def escape_name ( name )
0 commit comments