Sha256: 5e0527021eeb965ff3e711ca6374bc497ade68c6362025a78790dacac82284e1

Contents?: true

Size: 1.63 KB

Versions: 11

Compression:

Stored size: 1.63 KB

Contents

require "panda_pal/engine"
require 'panda_pal/plugins'
require 'panda_pal/helpers'

module PandaPal
  class LtiNavigationInUse < StandardError;end
  class NotMounted < StandardError;end

  @@lti_navigation = {}
  @@staged_navigation = {}
  @@lti_options = {}
  @@lti_properties = {}
  @@lti_environments = {}
  @@lti_custom_params = {}

  def self.lti_options= lti_options
    @@lti_options = lti_options
  end

  def self.lti_options
    @@lti_options.deep_dup
  end

  def self.lti_properties= lti_properties
    @@lti_properties = lti_properties
  end

  def self.lti_properties
    @@lti_properties.deep_dup
  end

  def self.lti_environments=(lti_environments)
    @@lti_environments = lti_environments
  end

  def self.lti_environments
    @@lti_environments.deep_dup
  end

  def self.lti_custom_params=(custom_params)
    @@lti_custom_params = custom_params
  end

  def self.lti_custom_params
    @@lti_custom_params.deep_dup
  end

  def self.register_navigation(navigation)
    @@lti_navigation[navigation] ||= {}
  end

  def self.stage_navigation(navigation, options)
    @@staged_navigation[navigation] = {} unless @@staged_navigation.has_key?(navigation)
    @@staged_navigation[navigation].merge!(options)
  end

  def self.lti_paths
    @@lti_navigation.deep_dup
  end

  def self.propagate_lti_navigation
    @@staged_navigation.each do |k,v|
      lti_navigation(k,v)
      @@staged_navigation.delete(k)
    end
  end

  private

  def self.lti_navigation(navigation, options)
    raise "lti navigation '#{navigation}' has not been registered!" unless @@lti_navigation.has_key?(navigation)
    @@lti_navigation[navigation].merge!(options)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
panda_pal-3.1.0 lib/panda_pal.rb
panda_pal-3.0.6 lib/panda_pal.rb
panda_pal-3.0.5 lib/panda_pal.rb
panda_pal-3.0.4 lib/panda_pal.rb
panda_pal-3.0.3 lib/panda_pal.rb
panda_pal-3.0.1 lib/panda_pal.rb
panda_pal-3.0.0 lib/panda_pal.rb
panda_pal-2.0.5 lib/panda_pal.rb
panda_pal-2.0.4 lib/panda_pal.rb
panda_pal-2.0.3 lib/panda_pal.rb
panda_pal-2.0.2 lib/panda_pal.rb