File: sample33.rb

package info (click to toggle)
ruby-graphviz 1.2.5-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,216 kB
  • sloc: ruby: 7,685; xml: 26; makefile: 17
file content (43 lines) | stat: -rw-r--r-- 896 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$:.unshift( "../lib" );
require 'graphviz/family_tree'

tree = GraphViz::FamilyTree.new do
  generation do
    abraham.is_a_man( "Abraham" )
    mona.is_a_woman( "Mona" )

    abraham.is_maried_with mona

    clancy.is_a_man( "Clancy" )
    jackeline.is_a_woman( "Jackeline" )

    clancy.is_maried_with jackeline
  end

  generation do
    herb.is_a_man( "Herb" )
    homer.is_a_man( "Homer" )

    marge.is_a_woman( "Marge" )
    patty.is_a_woman( "Patty" )
    selma.is_a_woman( "Selma" )

    homer.is_maried_with marge
  end

  couple( abraham, mona ).kids( herb, homer )
  couple( clancy, jackeline ).kids( marge, patty, selma )

  generation do
    bart.is_a_boy( "Bart" )
    lisa.is_a_girl( "Lisa" )
    maggie.is_a_girl( "Maggie" )
    ling.is_a_boy( "Ling" )
  end

  couple( homer, marge ).kids( bart, lisa, maggie )

  ling.kids( selma )
end

puts tree.graph.save( :none => String )