We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a673e28 commit c5b4ea4Copy full SHA for c5b4ea4
lib/evolvable.rb
@@ -299,19 +299,14 @@ def after_evolution(population); end
299
300
def after_initialize_evolvable; end
301
302
- def find_gene(name)
303
- return nil if @genome.nil?
304
-
305
- genes = @genome[name]&.dig(:genes)
306
- return nil if genes.nil? || genes.empty?
+ attr_accessor :fitness
307
308
- genes.first
+ def find_gene(name)
+ @genome&.find_gene(name)
309
end
310
311
def find_genes(name)
312
- return [] if @genome.nil?
313
314
- @genome[name]&.dig(:genes) || []
+ @genome&.find_genes(name) || []
315
316
317
attr_reader :population,
0 commit comments