Sha256: b61432cd789cab3ed64ad92439139b41026a4d5c10a2774a52ae037050665f69

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

# toolbox   method here
class Atome
  private

  def collapse
    @atome.each do |element, value|
      send(element, value) unless element == :type
    end
  end

  def security_pass(_element, _value)
    true
  end

  def sanitize(element, params)
    bloc_found = Universe.get_sanitizer_method(element)
    params = instance_exec(params, &bloc_found) if bloc_found.is_a?(Proc)
    params
  end

  def identity_generator
    { date: Time.now, location: geolocation }
  end

  def broadcasting(element, value)
    return unless @broadcast[:particles]&.include?(element)

    bloc_found = @broadcast[:bloc]
    instance_exec(self, element, value, &bloc_found) if bloc_found.is_a?(Proc)
  end

  def history(property, value)
    "historize : #{property} #{value}"
  end

  public

  def monitor(params, &proc_monitoring)
    params[:atomes].each do |atome_id|
      grab(atome_id).instance_variable_set('@broadcast', { particles: params[:particles], bloc: proc_monitoring })
    end
  end

  def <<(particle)
    value = particle.value
    real_atome[property] << value
  end

  def refresh
    collapse
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
atome-0.5.1.9 lib/atome/helpers/utilities.rb
atome-0.5.1.4 lib/atome/helpers/utilities.rb