Class: GraphViz::FamilyTree::Generation
- Defined in:
- lib/graphviz/family_tree/generation.rb
Instance Method Summary collapse
-
#all_persons ⇒ Object
:nodoc:.
-
#initialize(graph, persons, tree, gen_number) ⇒ Generation
constructor
:nodoc:.
-
#make(&block) ⇒ Object
:nodoc:.
-
#method_missing(sym, *args, &block) ⇒ Object
:nodoc:.
-
#number ⇒ Object
Generation number.
- #persons ⇒ Object
-
#size ⇒ Object
Generation size.
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_persons ⇒ Object
: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 |
#number ⇒ Object
Generation number
29 30 31 |
# File 'lib/graphviz/family_tree/generation.rb', line 29 def number @gen_number end |
#persons ⇒ Object
16 17 18 |
# File 'lib/graphviz/family_tree/generation.rb', line 16 def persons @persons end |
#size ⇒ Object
Generation size
34 35 36 |
# File 'lib/graphviz/family_tree/generation.rb', line 34 def size @persons.size end |