diff --git a/ahnen.jpg b/ahnen.jpg new file mode 100644 index 0000000..eb525cf Binary files /dev/null and b/ahnen.jpg differ diff --git a/geanology.rb b/geanology.rb new file mode 100644 index 0000000..506db18 --- /dev/null +++ b/geanology.rb @@ -0,0 +1,31 @@ +class Node + attr_reader :style + attr_accessor :childs + def initialize(style) + @style = style + @childs = [] + end +end + +nodes = {} +f = File.open("ahnen.dot.txt","r") +f.each_line do |line| + case line + # Label1 -> Label1 [style...] + when /^\s*(\S+)\s*->\s*(\S+)\s*\[([^\]]+)\]/ + parent, child, style = $1, $2, $3 + if not nodes[child] + $stderr.puts("child not found '#{child}'") + elsif not nodes[parent] + $stderr.puts("parent not found '#{parent}'") + else + nodes[parent].childs << child + end + # Label [style...] + when /^\s*(\S+)\s+\[([^\]]+)\]/ + node, style = $1, $2 + nodes[node] = Node.new(style) + else + #print "ignore -> #{line}" + end +end