Sha256: 2741407f84eb1273c1836a2c69747e1f2b4613e7ab22f67601f5bd29cd84345b

Contents?: true

Size: 1.2 KB

Versions: 16

Compression:

Stored size: 1.2 KB

Contents

require 'rubypitaya/core/instance_holder'

module RubyPitaya

  class HandlerBase

    class_attribute :non_authenticated_routes, default: []
    class_attribute :handler_objects, default: nil, instance_reader: false, instance_writer: false, instance_accessor: false, instance_predicate: false

    attr_reader :objects, :log, :redis, :setup, :config, :params, :session, :postman

    def initialize
      @log = nil
      @redis = nil
      @setup = nil
      @config = nil
      @params = nil
      @session = nil
      @postman = nil

      @objects = self.class.objects
    end

    def set_attributes(log, redis, mongo, setup, config, params, session, postman)
      @log = log
      @redis = redis
      @mongo = mongo
      @setup = setup
      @config = config
      @params = params
      @session = session
      @postman = postman
    end

    def self.objects
      self.handler_objects ||= InstanceHolder.new
      return self.handler_objects
    end

    def self.non_authenticated_actions(*action_names)
      self.non_authenticated_routes = action_names.map(&:to_s)
    end

    def self.authenticated_action_name?(action_name)
      !self.non_authenticated_routes.include?(action_name.to_s)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rubypitaya-3.4.2 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.4.1 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.4.0 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.3.7 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.3.6 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.3.5 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.3.4 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.3.3 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.3.2 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.3.1 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.3.0 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.2.0 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.1.1 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.1.0 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.0.3 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.0.2 ./lib/rubypitaya/core/handler_base.rb