Sha256: e68cc7f833c2de8b397f669f7c422c53a4ade6e24210342a5e612f8093699b1d

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

class StoredSession::Configuration
  include ActiveModel::Model
  include ActiveModel::Attributes

  attribute :base_controller_class_name, :string, default: "::ApplicationController"
  attribute :base_job_class_name, :string, default: "::ApplicationJob"
  attribute :base_record_class_name, :string, default: "::ApplicationRecord"

  attribute :connects_to

  attribute :sessions_table_name, :string, default: "stored_sessions"
  attribute :session_class_name, :string, default: "::StoredSession::Session"
  attribute :session_max_created_age, default: 30.days
  attribute :session_max_updated_age, default: 30.days

  attribute :expire_sessions_job_queue_as, default: :default

  validates :base_controller_class_name, presence: true
  validates :base_job_class_name, presence: true
  validates :base_record_class_name, presence: true

  validates :sessions_table_name, presence: true
  validates :session_class_name, presence: true
  validates :session_max_created_age, numericality: { greater_than: 0 }, presence: true
  validates :session_max_updated_age, numericality: { greater_than: 0 }, presence: true

  validates :expire_sessions_job_queue_as, presence: true

  def base_controller_class = base_controller_class_name.constantize
  def base_job_class = base_job_class_name.constantize
  def base_record_class = base_record_class_name.constantize
  def session_class = session_class_name.constantize
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stored_session-0.4.0 lib/stored_session/configuration.rb
stored_session-0.3.0 lib/stored_session/configuration.rb