Sha256: 6d137408c87d789d9c1826abba3ffe83f9991cbad4acb2d6c65cf3fdba2a162e

Contents?: true

Size: 1.86 KB

Versions: 3

Compression:

Stored size: 1.86 KB

Contents

# frozen_string_literal: true

# use to sanitize and secure user input
module Essentials
  @default_params = {
    render_engines: [:browser],
    animation: { type: :animation },
    element: { type: :element, renderers: [] },
    box: { renderers: '', id: '', type: :shape, parents: [], children: [], width: 99, height: 99,
           color: { left: 0, top: 0,  red: 0.1, green: 0.9, blue: 0.9, alpha: 1, diffusion: :linear },
           left: 100, top: 100 },
    circle: { renderers: '', id: '', type: :shape, parents: [], children: [], width: 99, height: 99,
              color: { left: 0, top: 0, red: 0.1, green: 0.9, blue: 0.9, alpha: 1, diffusion: :linear },
              left: 100, top: 100, smooth: '100%' },
    shape: { renderers: '', id: '', width: 100, type: :shape, height: 100, left: 100, top: 100,
             color: { left: 0, top: 0, red: 0.1, green: 0.9, blue: 0.9, alpha: 1, diffusion: :linear },
             generator: :manual },
    text: { renderers: '', id: '',type: :text, parents: [:view], children: [], visual: { size: 25 },
            color: { left: 0, top: 0, red: 0.3, green: 0.3, blue: 0.3, alpha: 1, diffusion: :linear },
            data: 'this is a text sample', width: 199, height: 33 },
    drm: { type: :drm },
    shadow: {}
  }

  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

3 entries across 3 versions & 1 rubygems

Version Path
atome-0.5.2.8 lib/atome/helpers/essentials.rb
atome-0.5.2.7 lib/atome/helpers/essentials.rb
atome-0.5.2.5 lib/atome/helpers/essentials.rb