Sha256: 511fc8ef12bc0839c90a0c2649015a55791fb422aea26dfcc4023e55a3af9694

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

# The enclosing module for the library
module Sqewer
  class Error < StandardError
  end

  # Eager-load everything except extensions. Sort to ensure
  # the files load in the same order on all platforms.
  Dir.glob(__dir__ + '/**/*.rb').sort.each do |path|
    if path != __FILE__ && File.dirname(path) !~ /\/extensions$/
      require path
    end
  end

  # Returns a singleton of Aws::SQS::Client
  def self.client
    Sqewer::Connection.client
  end

  # Loads a particular Sqewer extension that is not loaded
  # automatically during the gem require.
  #
  # @param extension_name[String] the name of the extension to load (like `active_job_adapter`)
  def self.require_extension(extension_name)
    path = File.join("sqewer", "extensions", extension_name)
    require_relative path
  end

  # Shortcut access to Submitter#submit.
  #
  # @see {Sqewer::Submitter#submit!}
  def self.submit!(*jobs, **options)
    Sqewer::Submitter.default.submit!(*jobs, **options)
  end

  # If we are within Rails, load the railtie
  require_relative 'sqewer/extensions/railtie' if defined?(Rails)

  # Explicitly require retriable so that it ia available for use.
  require 'retriable'
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sqewer-10.0.0 lib/sqewer.rb
sqewer-9.0.0 lib/sqewer.rb
sqewer-8.1.0 lib/sqewer.rb
sqewer-8.1.0.pre.1 lib/sqewer.rb
sqewer-8.0.3 lib/sqewer.rb
sqewer-8.0.2 lib/sqewer.rb
sqewer-8.0.1 lib/sqewer.rb
sqewer-8.0.0 lib/sqewer.rb