Sha256: b59c3de11435fd96f6d0442d57b6d1fb20bcd0673f56fa302f2577e3b43d729c

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

# allow to access Atome class using only a uniq atome
class Genesis
  class << self
    def generator
      Atome.new
    end
  end
end

# Genesis method here
class Atome
  def build_particle(particle_name, &particle_proc)
    # we add the new method to the particle's collection of methods
    Universe.add_to_particle_list(particle_name)
    auto_render_generator(particle_name)
    new_particle(particle_name, &particle_proc)
    additional_particle_methods(particle_name, &particle_proc)
  end

  def build_atome(atome_name, &atome_proc)
    # we add the new method to the atome's collection of methods
    Universe.add_to_atome_list(atome_name)
    auto_render_generator(atome_name)
    new_atome(atome_name, &atome_proc)
  end

  def auto_render_generator(element)
    Universe.renderer_list.each do |render_engine|
      build_render_method("#{render_engine}_#{element}")
    end
  end

  def build_render_method(renderer_name, &method_proc)
    new_render_engine(renderer_name, &method_proc)
  end

  def build_sanitizer(method_name, &method_proc)
    Universe.add_sanitizer_method(method_name.to_sym, &method_proc)
  end

  def build_option(method_name, &method_proc)
    Universe.add_optional_method(method_name.to_sym, &method_proc)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
atome-0.5.1.9 lib/atome/genesis/genesis.rb
atome-0.5.1.4 lib/atome/genesis/genesis.rb