Sha256: 97d09096b8a18b6b97f7605002b1d6de5283bf27b77656d535f07dd254c14cdf

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true
def new(params, &bloc)
  generator = Genesis.generator
  if params.key?(:particle)
    # render indicate if the particle needs to be rendered
    # store tell the system if it need to store the particle value
    # type help the system what type of type the particle will receive and store
    generator.build_particle(params[:particle], { render: params[:render],
                                                  store: params[:store], type: params[:type] }, &bloc)
  elsif params.key?(:atome)
    generator.build_atome(params[:atome], &bloc)
  elsif params.key?(:sanitizer)
    generator.build_sanitizer(params[:sanitizer], &bloc)
  elsif params.key?(:pre)
    generator.build_option("pre_render_#{params[:pre]}", &bloc)
  elsif params.key?(:post)
    generator.build_option("post_render_#{params[:post]}", &bloc)
  elsif params.key?(:browser)
    generator.build_render("browser_#{params[:browser]}", &bloc)
  end
end

def grab(atome_to_get)
  Universe.atomes[atome_to_get]
end

def box(params = {}, &proc)
  grab(:view).box(params, &proc)
end

def circle(params = {}, &proc)
  grab(:view).circle(params, &proc)
end

def matrix(params = {}, &proc)
  grab(:view).matrix(params, &proc)
end

# the method below generate Atome method creation at Object level
def create_method_at_object_level(element)

  Object.define_method element do |params, &user_proc|
    grab(:view).send(element, params, &user_proc)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
atome-0.5.3.7.3 lib/atome/extensions/atome.rb
atome-0.5.3.7.2 lib/atome/extensions/atome.rb