Sha256: a8a189bebec96b99466ac0cacc50b6ea57afa1959dc1305675c2d243f554dde3

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true

module Firebug
  # A configuration object.
  #
  # @attr [String] key
  #   The encryption key used to encrypt and decrypt cookies.
  # @attr [String] table_name
  #   The name of the sessions table.
  # @attr [Boolean] truncate_user_agent
  #   Truncate the user-agent to 120 characters.
  # @attr [Boolean] match_user_agent
  #   Use the user-agent in addition to the session ID.
  # @attr [Boolean] match_ip_address
  #   Use the remote ip address in addition to the session ID.
  # @attr [Boolean] silence_logger
  #   Silence ActiveRecord logs.
  # @attr [Proc] session_filter
  #   Return true if this request should have it's session written.
  #   @see ActionDispatch::Session::CodeIgniterStore#commit_session?
  class Configuration
    attr_reader :table_name

    attr_accessor :key
    attr_accessor :truncate_user_agent
    attr_accessor :match_user_agent
    attr_accessor :match_ip_address
    attr_accessor :session_filter
    attr_accessor :silence_logger

    def initialize
      self.truncate_user_agent = false
      self.match_user_agent = false
      self.match_ip_address = false
      self.silence_logger = true
      # default to always writing the session
      self.session_filter = ->(_) { true }
    end

    # Sets the table name for (see Firebug::Session)
    #
    # @param [String] value
    def table_name=(value)
      Firebug::Session.table_name = value
      @table_name = value
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
firebug-1.2.2 lib/firebug/configuration.rb
firebug-1.2.1 lib/firebug/configuration.rb
firebug-1.2.0 lib/firebug/configuration.rb
firebug-1.1.0 lib/firebug/configuration.rb