lib/dogviz.rb in dogviz-0.0.9 vs lib/dogviz.rb in dogviz-0.0.10

- old
+ new

@@ -17,13 +17,24 @@ break unless ancestors.last.respond_to?(:parent) ancestors << ancestors.last.parent end ancestors end + def info(fields) + @info.merge! fields + setup_render_attributes(label: label_with_info) + end def doclink(url) setup_render_attributes(URL: url) end + def label_with_info + lines = [ name ] + @info.each {|k, v| + lines << "#{k}: #{v}" + } + lines.join "\n" + end def setup_render_attributes(attributes) @attributes = {} if @attributes.nil? @attributes.merge!(attributes) end def rollup? @@ -101,10 +112,11 @@ @name = name @id = create_id(name, parent) @pointers = [] @rollup = false @skip = false + @info = {} @edge_heads = [] rollup! if options[:rollup] options.delete(:rollup) @@ -213,9 +225,10 @@ @by_name = Registry.new name @parent = parent @name = name @id = create_id(name, parent) @skip = false + @info = {} init_rollup options setup_render_attributes label: name