Class: Darwinning::Organism
- Inherits:
-
Object
- Object
- Darwinning::Organism
- Includes:
- ClassLevelInheritableAttributes
- Defined in:
- lib/darwinning/organism.rb
Instance Attribute Summary collapse
-
#fitness ⇒ Object
Returns the value of attribute fitness.
-
#genes ⇒ Object
Returns the value of attribute genes.
-
#genotypes ⇒ Object
Returns the value of attribute genotypes.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(genotypes = {}) ⇒ Organism
constructor
A new instance of Organism.
Methods included from ClassLevelInheritableAttributes
Constructor Details
#initialize(genotypes = {}) ⇒ Organism
Returns a new instance of Organism.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/darwinning/organism.rb', line 37 def initialize(genotypes = {}) if genotypes == {} # fill genotypes with expressed Genes @genotypes = {} genes.each do |g| # make genotypes a hash with gene objects as keys @genotypes[g] = g.express end else @genotypes = genotypes end @fitness = nil end |
Instance Attribute Details
#fitness ⇒ Object
Returns the value of attribute fitness.
32 33 34 |
# File 'lib/darwinning/organism.rb', line 32 def fitness @fitness end |
#genes ⇒ Object
Returns the value of attribute genes.
32 33 34 |
# File 'lib/darwinning/organism.rb', line 32 def genes @genes end |
#genotypes ⇒ Object
Returns the value of attribute genotypes.
32 33 34 |
# File 'lib/darwinning/organism.rb', line 32 def genotypes @genotypes end |
#name ⇒ Object
Returns the value of attribute name.
32 33 34 |
# File 'lib/darwinning/organism.rb', line 32 def name @name end |