Sha256: fa74628faa0ec7434f8363704ac11fe102d67d36433e8bbf7673215106a56371
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
module Inboxable class Configuration ALLOWED_ORMS = %i[activerecord mongoid].freeze attr_accessor :orm, :inbox_model def initialize raise Error, 'Sidekiq is not available. Unfortunately, sidekiq must be available for Inboxable to work' unless Object.const_defined?('Sidekiq') raise Error, 'Inboxable Gem uses the sidekiq-cron Gem. Make sure you add it to your project' unless Object.const_defined?('Sidekiq::Cron') raise Error, 'Inboxable Gem only supports Rails but you application does not seem to be a Rails app' unless Object.const_defined?('Rails') raise Error, 'Inboxable Gem only support Rails version 7 and newer' if Rails::VERSION::MAJOR < 7 Sidekiq::Options[:cron_poll_interval] = ENV.fetch('INBOXABLE__CRON_POLL_INTERVAL', 5).to_i Sidekiq::Cron::Job.create(name: 'InboxablePollingReceiver', cron: ENV.fetch('INBOXABLE__CRON', '*/5 * * * * *'), class: 'Inboxable::PollingReceiverWorker') end def orm=(orm) raise ArgumentError, "ORM must be one of #{ALLOWED_ORMS}" unless ALLOWED_ORMS.include?(orm) @orm = orm end def orm @orm || :activerecord end def inbox_model @inbox_model || 'Inbox' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
inboxable-0.1.2 | lib/inboxable/configuration.rb |
inboxable-0.1.1 | lib/inboxable/configuration.rb |