Class: GraphViz::FamilyTree::Generation

Inherits:
Object
  • Object
show all
Defined in:
lib/graphviz/family_tree/generation.rb

Instance Method Summary collapse

Constructor Details

#initialize(graph, persons, tree, gen_number) ⇒ Generation

:nodoc:



4
5
6
7
8
9
10
# File 'lib/graphviz/family_tree/generation.rb', line 4

def initialize( graph, persons, tree, gen_number ) #:nodoc:
  @graph = graph
  @all_persons = persons
  @persons = {}
  @tree = tree
  @gen_number = gen_number
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object

:nodoc:



24
25
26
# File 'lib/graphviz/family_tree/generation.rb', line 24

def method_missing(sym, *args, &block) #:nodoc:
  all_persons[sym.to_s] ||= (persons[sym.to_s] ||= GraphViz::FamilyTree::Person.new( @graph, @tree, self, sym.to_s ))
end

Instance Method Details

#all_personsObject

:nodoc:



12
13
14
# File 'lib/graphviz/family_tree/generation.rb', line 12

def all_persons #:nodoc:
  @all_persons
end

#make(&block) ⇒ Object

:nodoc:



20
21
22
# File 'lib/graphviz/family_tree/generation.rb', line 20

def make( &block ) #:nodoc:
  instance_eval(&block) if block
end

#numberObject

Generation number



29
30
31
# File 'lib/graphviz/family_tree/generation.rb', line 29

def number
  @gen_number
end

#personsObject



16
17
18
# File 'lib/graphviz/family_tree/generation.rb', line 16

def persons
  @persons
end

#sizeObject

Generation size



34
35
36
# File 'lib/graphviz/family_tree/generation.rb', line 34

def size
  @persons.size
end