lib/atome/kernel/universe.rb in atome-0.5.3.7.3 vs lib/atome/kernel/universe.rb in atome-0.5.3.7.8
- old
+ new
@@ -1,18 +1,19 @@
# frozen_string_literal: true
# universe method here
class Universe
+ @counter=0
@atomes = {}
@classes = {}
@atome_list = []
@particle_list = {}
@renderer_list = %i[html browser headless server]
@options = {}
@sanitizers = {}
class << self
- attr_reader :atomes, :renderer_list, :atome_list, :particle_list, :classes
+ attr_reader :atomes, :renderer_list, :atome_list, :particle_list, :classes, :counter
def add_to_particle_list(particle = nil, type)
instance_variable_get('@particle_list')[particle]=type
end
@@ -41,9 +42,10 @@
end
def add_to_atomes(id, atome)
# instance_variable_get('@atomes').merge!(atome)
@atomes[id] = atome
+ @counter=@counter+1
end
def update_atome_id(id, atome, prev_id)
@atomes[id] = atome
@atomes.delete(prev_id)