lib/atome/kernel/universe.rb in atome-0.5.6.7.8 vs lib/atome/kernel/universe.rb in atome-0.5.6.8.3
- old
+ new
@@ -4,10 +4,11 @@
class Universe
@counter = 0
@atomes = {}
@atomes_ids = {}
@atome_list = []
+ @molecule_list = []
@particle_list = {}
@renderer_list = %i[html browser headless server log]
@sanitizers = {}
@specificities = {}
@messages = {}
@@ -22,11 +23,11 @@
@allow_sync = false
@connected= false
@database_ready = false
# @historicize=false
class << self
- attr_reader :atomes, :atomes_ids, :renderer_list, :atome_list, :particle_list, :classes, :counter, :atomes_specificities
+ attr_reader :atomes, :atomes_ids, :renderer_list,:molecule_list, :atome_list, :particle_list, :classes, :counter, :atomes_specificities
attr_accessor :connected,:allow_sync, :allow_localstorage, :database_ready
def messages
@messages
end
@@ -66,11 +67,12 @@
def categories
@categories
end
def add_to_particle_list(particle = nil, type, category)
- instance_variable_get('@particle_list')[particle] = { type: type, category: category }
+ # instance_variable_get('@particle_list')[particle] = { type: type, category: category }
+ @particle_list[particle] = { type: type, category: category }
end
def add_atomes_specificities atome_type_to_add
@specificities[atome_type_to_add] = {}
end
@@ -85,19 +87,25 @@
@specificities
end
def add_sanitizer_method(method_name, &method_proc)
# this method is used to add sanitizer methods
- instance_variable_get('@sanitizers').merge!({ method_name => method_proc })
+ # instance_variable_get('@sanitizers').merge!({ method_name => method_proc })
+ @sanitizers.merge!({ method_name => method_proc })
end
def get_sanitizer_method(method_name)
# this method is used to add optional methods
- instance_variable_get('@sanitizers')[method_name]
+ # instance_variable_get('@sanitizers')[method_name]
+ @sanitizers[method_name]
end
def add_to_atome_list(atome)
- instance_variable_get('@atome_list').push(atome)
+ @atome_list.push(atome)
+ end
+
+ def add_to_molecule_list(molecule)
+ @molecule_list.push(molecule)
end
def add_to_atomes(aid, atome)
@atomes[aid] = atome
@counter = @counter + 1