lib/atome/helpers/utilities.rb in atome-0.5.3.7.3 vs lib/atome/helpers/utilities.rb in atome-0.5.3.7.8
- old
+ new
@@ -4,27 +4,25 @@
class Atome
private
def collapse
@atome.each do |element, value|
+ # puts "=============> #{element}"
send(element, value) unless element == :type
end
end
def security_pass(_element, _value)
true
end
- def sanitize(element, params)
+ def sanitize(element, params,&user_proc)
bloc_found = Universe.get_sanitizer_method(element)
- params = instance_exec(params, &bloc_found) if bloc_found.is_a?(Proc)
+ params = instance_exec(params,user_proc, &bloc_found) if bloc_found.is_a?(Proc)
params
end
- def identity_generator
- { date: Time.now, location: geolocation }
- end
def history(property, value)
"historize : #{property} #{value}"
end
@@ -40,15 +38,15 @@
public
def monitor(params=nil, &proc_monitoring)
if params
- atome[:monitor] ||= {}
+ monitoring=atome[:monitor] ||= {}
params[:atomes].each do |atome_id|
target_broadcaster = grab(atome_id).instance_variable_get('@broadcast')
monitor_id = params[:id] || "monitor#{target_broadcaster.length}"
- atome[:monitor] [monitor_id]=params.merge({code: proc_monitoring})
+ monitoring[monitor_id]=params.merge({code: proc_monitoring})
target_broadcaster[monitor_id] = { particles: params[:particles], code: proc_monitoring }
end
else
atome[:monitor]
end
@@ -113,9 +111,21 @@
end
def each(&proc)
value.each do |val|
instance_exec(val, &proc) if proc.is_a?(Proc)
+ end
+ end
+
+ def include?(value)
+ self.value.include?(value)
+ end
+
+
+
+ def each_with_index(*args)
+ self.value.each_with_index do |val, index|
+ yield(val, index)
end
end
def [](range)
if value[range].class == Atome