Sha256: 278123421a456601c5c770e74050cb2595cc6c0c6106c620ec8d86075e71cb69

Contents?: true

Size: 1.18 KB

Versions: 36

Compression:

Stored size: 1.18 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, :services, :setup, :config, :params, :session, :postman

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

      @objects = self.class.objects
    end

    def set_attributes(log, services, setup, config, params, session, postman)
      @log = log
      @services = services
      @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

36 entries across 32 versions & 1 rubygems

Version Path
rubypitaya-3.19.6 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.19.5 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.19.4 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.19.3 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.19.2 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.19.1 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.19.0 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.18.0 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.17.2 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.17.1 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.17.0 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.16.0 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.15.3 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.15.2 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.15.1 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.15.0 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.14.0 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.13.1 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.13.0 ./lib/rubypitaya/core/handler_base.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rubypitaya-3.12.1/lib/rubypitaya/core/handler_base.rb