Sha256: 385e12faec96d369029e35ada17d52a801b617d8aaf64f8a91ebf6be2261bce7

Contents?: true

Size: 1.99 KB

Versions: 4

Compression:

Stored size: 1.99 KB

Contents

# frozen_string_literal: true

# use to sanitize and secure user input
module Essentials
  @default_params = {
    render_engines: [:browser],
    collector: { type: :element, renderers: [], children: [] },
    animation: { type: :animation, children: [] },
    element: { type: :element, renderers: [], children: [] },
    matrix: { renderers: [], id: '', type: :shape, parents: [], width: 99, height: 99,
              attached: [:matrix_color], children: [],
              left: 100, top: 100, clones: [], preset: :matrix },
    box: { renderers: [], id: '', type: :shape, parents: [], width: 99, height: 99,
           attached: [:box_color], children: [],
           left: 100, top: 100, clones: [], preset: :box },
    circle: { renderers: [], id: '', type: :shape, parents: [], width: 99, height: 99, smooth: '100%',
              attached: [:circle_color], children: [],
              left: 100, top: 100, clones: [], preset: :circle },
    shape: { renderers: [], id: '', type: :shape, parents: [], width: 99, height: 99,
             attached: [:shape_color], children: [],
             left: 100, top: 100, clones: [] },
    text: { renderers: [], id: '', type: :text, parents: [:view], visual: { size: 25 },
            attached: [:text_color], children: [],
            data: 'this is a text sample', width: 199, height: 33, clones: [] },
    drm: { type: :drm },
    shadow: {},
    color: {}
  }

  def self.default_params
    @default_params
  end

  def self.new_default_params(new_default)
    @default_params.merge!(new_default)
  end

  def validation(atome_instance_var)
    # TODO: write validation scheme
    true if atome_instance_var
  end

  def add_essential_drm(params)
    essential_drm = { authorisation: { read: [Atome.current_user], write: [Atome.current_user] },
                      atome: { read: [:all], write: [:me] } }
    params[:drm] = if params[:drm]
                     essential_drm.merge(params[:drm])
                   else
                     essential_drm
                   end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
atome-0.5.3.8.0 lib/atome/helpers/essentials.rb
atome-0.5.3.7.8 lib/atome/helpers/essentials.rb
atome-0.5.3.7.3 lib/atome/helpers/essentials.rb
atome-0.5.3.7.2 lib/atome/helpers/essentials.rb