Class: Genetica::ChromosomeBuilder
- Inherits:
-
Object
- Object
- Genetica::ChromosomeBuilder
- Defined in:
- lib/genetica/chromosome_builder.rb
Instance Attribute Summary collapse
-
#alleles ⇒ Object
Returns the value of attribute alleles.
-
#length ⇒ Object
Returns the value of attribute length.
Instance Method Summary collapse
- #chromosome ⇒ Object
-
#initialize ⇒ ChromosomeBuilder
constructor
A new instance of ChromosomeBuilder.
Constructor Details
#initialize ⇒ ChromosomeBuilder
Returns a new instance of ChromosomeBuilder.
5 6 7 |
# File 'lib/genetica/chromosome_builder.rb', line 5 def initialize set_default_chromosome_attributes end |
Instance Attribute Details
#alleles ⇒ Object
Returns the value of attribute alleles.
3 4 5 |
# File 'lib/genetica/chromosome_builder.rb', line 3 def alleles @alleles end |
#length ⇒ Object
Returns the value of attribute length.
3 4 5 |
# File 'lib/genetica/chromosome_builder.rb', line 3 def length @length end |
Instance Method Details
#chromosome ⇒ Object
9 10 11 12 13 |
# File 'lib/genetica/chromosome_builder.rb', line 9 def chromosome Chromosome.new.tap do |chromosome| length.times { chromosome << alleles.sample } end end |