Sha256: 897bf2fb2fe7700778e9e80f5a47f8b45fb1397fe9298e579b1955ba6f1c4029
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true # TODO: params shouldn't be merge but they must respect the order # TODO: Add default value for each methods below # TODO: Factorise codes below # TODO we must clarified/unified the usage of presets and sanitizer it is not clear class Atome def atome_common(atome_type, params) # TODO : optimise the whole code below and make it rubocop friendly essential_params = Essentials.default_params[atome_type] || {} essential_params[:type] = essential_params[:type] || :element essential_params[:renderers] = essential_params[:renderers] || @atome[:renderers] essential_params[:id] = params[:id] || identity_generator(atome_type) essential_params[:attach] = params[:attach] || [@atome[:id]] || [:view] essential_params.merge(params) end def box(params = {}, &bloc) atome_type = :box params = atome_common(atome_type, params) Atome.new({ atome_type => params }, &bloc) end def vector(params = {}, &bloc) atome_type = :vector params = atome_common(atome_type, params) Atome.new({ atome_type => params }, &bloc) end def circle(params = {}, &bloc) atome_type = :circle # puts "counter#{Universe.counter}" params = atome_common(atome_type, params) # puts "params ==> #{params} : #{Universe.counter}" Atome.new({ atome_type => params }, &bloc) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
atome-0.5.4.1.3 | lib/atome/presets/atome.rb |
atome-0.5.4.1.2 | lib/atome/presets/atome.rb |
atome-0.5.4.1.1 | lib/atome/presets/atome.rb |