Sha256: bbe15a92ceb674c788c6f3c2b7454855887d1dab8e1f86eb860bbdb7de4b0d80

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

require 'rubypitaya/core/instance_holder'

module RubyPitaya

  class HandlerBase

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

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

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

      @bll = self.class.bll
    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.bll
      self.handler_bll ||= InstanceHolder.new
    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

4 entries across 4 versions & 1 rubygems

Version Path
rubypitaya-3.0.1 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.0.0 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-2.27.1 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-2.27.0 ./lib/rubypitaya/core/handler_base.rb