Sha256: f7609c2763ff1cada0297854d2115d39b0677c34e9b81d56c8d778b6c9daea6f

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

module Statesman
  autoload :Config,     "statesman/config"
  autoload :Machine,    "statesman/machine"
  autoload :Callback,   "statesman/callback"
  autoload :Guard,      "statesman/guard"
  autoload :Utils,      "statesman/utils"
  autoload :Version,    "statesman/version"
  module Adapters
    autoload :Memory,       "statesman/adapters/memory"
    autoload :ActiveRecord, "statesman/adapters/active_record"
    autoload :ActiveRecordTransition,
             "statesman/adapters/active_record_transition"
    autoload :ActiveRecordQueries,
             "statesman/adapters/active_record_queries"
    autoload :TypeSafeActiveRecordQueries,
             "statesman/adapters/type_safe_active_record_queries"
  end
  require "statesman/railtie" if defined?(::Rails::Railtie)

  # Example:
  #   Statesman.configure do
  #     storage_adapter Statesman::ActiveRecordAdapter
  #     enable_mysql_gaplock_protection
  #   end
  #
  def self.configure(&block)
    @config = Config.new(block)
    @storage_adapter = config.adapter_class
  end

  def self.storage_adapter
    @storage_adapter || Adapters::Memory
  end

  def self.mysql_gaplock_protection?
    return @mysql_gaplock_protection unless @mysql_gaplock_protection.nil?

    @mysql_gaplock_protection = config.mysql_gaplock_protection?
  end

  def self.config
    @config ||= Config.new
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
statesman-11.0.0 lib/statesman.rb
statesman-10.2.3 lib/statesman.rb
statesman-10.2.2 lib/statesman.rb
statesman-10.2.1 lib/statesman.rb
statesman-10.2.0 lib/statesman.rb