class GraphViz::FamilyTree::Person
Public Instance Methods
id()
click to toggle source
# File lib/graphviz/family_tree/person.rb, line 17 def id @node.id end
is_a_boy( name )
click to toggle source
Define the current person as a boy
greg.is_a_boy( "Greg" )
# File lib/graphviz/family_tree/person.rb, line 52 def is_a_boy( name ) is_a_man( name ) end
is_a_girl( name )
click to toggle source
Define the current perdon as a girl
maia.is_a_girl( "Maia" )
# File lib/graphviz/family_tree/person.rb, line 66 def is_a_girl( name ) is_a_woman( name ) end
is_a_man( name )
click to toggle source
Define the current person as a man
greg.is_a_man( "Greg" )
# File lib/graphviz/family_tree/person.rb, line 44 def is_a_man( name ) @node["label"] = name @node["color"] = "blue" end
is_a_woman( name )
click to toggle source
Define the current perdon as a woman
mu.is_a_woman( "Muriel" )
# File lib/graphviz/family_tree/person.rb, line 59 def is_a_woman( name ) @node["label"] = name @node["color"] = "pink" end
is_dead()
click to toggle source
Define the current person as dead
jack.is_dead
# File lib/graphviz/family_tree/person.rb, line 108 def is_dead @node["style"] = "filled" end
is_divorced_with( x )
click to toggle source
Define that's two persons are divorced
sophie.is_divorced_with john
# File lib/graphviz/family_tree/person.rb, line 84 def is_divorced_with( x ) node = @graph.add_nodes( "#{@node.id}And#{x.node.id}" ) node["shape"] = "point" node["color"] = "red" @graph.add_edges( @node, node, "dir" => "none", "color" => "red" ) @graph.add_edges( node, x.node, "dir" => "none", "color" => "red" ) @tree.add_couple( self, x, node ) end
is_maried_with( x )
click to toggle source
Define that's two persons are maried
mu.is_maried_with greg
# File lib/graphviz/family_tree/person.rb, line 73 def is_maried_with( x ) node = @graph.add_nodes( "#{@node.id}And#{x.node.id}" ) node["shape"] = "point" @graph.add_edges( @node, node, "dir" => "none" ) @graph.add_edges( node, x.node, "dir" => "none" ) @tree.add_couple( self, x, node ) end
is_widower_of( x )
click to toggle source
Define that's a person is widower of another
simon.is_widower_of elisa
# File lib/graphviz/family_tree/person.rb, line 96 def is_widower_of( x ) #veuf node = @graph.add_nodes( "#{@node.id}And#{x.node.id}" ) node["shape"] = "point" node["color"] = "green" @graph.add_edges( @node, node, "dir" => "none", "color" => "green" ) @graph.add_edges( node, x.node, "dir" => "none", "color" => "green" ) @tree.add_couple( self, x, node ) end
kids( *z )
click to toggle source
Define the kids of a single person
alice.kids( john, jack, julie )
# File lib/graphviz/family_tree/person.rb, line 115 def kids( *z ) GraphViz::FamilyTree::Couple.new( @graph, @node, [self] ).kids( *z ) end
name()
click to toggle source
# File lib/graphviz/family_tree/person.rb, line 21 def name @node.label || @node.id end
sibling()
click to toggle source
# File lib/graphviz/family_tree/person.rb, line 25 def sibling @sibling end
sibling=(x)
click to toggle source
# File lib/graphviz/family_tree/person.rb, line 29 def sibling=(x) @sibling=x end