Sha256: 9eb05a0dcb8817ffc50d32dbe19005b915b00868528abfdcea08015a6de4df67

Contents?: true

Size: 996 Bytes

Versions: 5

Compression:

Stored size: 996 Bytes

Contents

require 'unleash/version'
require 'unleash/configuration'
require 'unleash/strategy/base'
require 'unleash/context'
require 'unleash/client'
require 'logger'

Gem.find_files('unleash/strategy/**/*.rb').each{ |path| require path unless path.end_with? '_spec.rb' }

module Unleash
  TIME_RESOLUTION = 3

  STRATEGIES = Unleash::Strategy.constants
    .select{ |c| Unleash::Strategy.const_get(c).is_a? Class }
    .reject{ |c| ['NotImplemented', 'Base'].include?(c.to_s) }
    .map do |c|
      lowered_c = c.to_s
      lowered_c[0] = lowered_c[0].downcase
      [lowered_c.to_sym, Object.const_get("Unleash::Strategy::#{c}").new]
    end
    .to_h

  class << self
    attr_accessor :configuration, :toggle_fetcher, :toggles, :toggle_metrics, :reporter, :logger
  end

  # Support for configuration via yield:
  def self.configure
    self.configuration ||= Unleash::Configuration.new
    yield(configuration)

    self.configuration.validate!
    self.configuration.refresh_backup_file!
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
unleash-4.3.0 lib/unleash.rb
unleash-4.2.1 lib/unleash.rb
unleash-4.2.0 lib/unleash.rb
unleash-4.1.0 lib/unleash.rb
unleash-4.0.0 lib/unleash.rb