Sha256: 55a9b87790520512a078cd82380de9a57833914449b7bd6c56222b05093e96c0
Contents?: true
Size: 621 Bytes
Versions: 6
Compression:
Stored size: 621 Bytes
Contents
module Rubrowser class D3 def initialize(node) @node = node end def constants node_id(node) end def occurences node_occurences(node) end private attr_reader :node def node_id(node) node.children.map do |n| node_id(n) end.reduce(:+).to_a.push({ name: node.name, id: node.id }) end def node_occurences(node) occurences = [] occurences += node.children.map { |n| node_occurences(n) }.reduce(:+).to_a occurences += node.occurences.map { |n| {source: node.id, target: n.id } }.to_a occurences end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
rubrowser-0.1.5 | lib/d3.rb |
rubrowser-0.1.4 | lib/d3.rb |
rubrowser-0.1.3 | lib/d3.rb |
rubrowser-0.1.2 | lib/d3.rb |
rubrowser-0.1.1 | lib/d3.rb |
rubrowser-0.1.0 | lib/d3.rb |