Sha256: 71cc29a16c7da20db95afdab1fccfd6cd3a0698ae620bd3bc21d84f7856d571a

Contents?: true

Size: 1.25 KB

Versions: 20

Compression:

Stored size: 1.25 KB

Contents

module SplitIoClient
  class SplitFactory
    include SplitIoClient::Cache::Repositories
    include SplitIoClient::Cache::Stores

    attr_reader :adapter, :client, :manager

    def initialize(api_key, config_hash = {})
      @api_key = api_key
      @config = SplitConfig.new(config_hash)

      @cache_adapter = @config.cache_adapter

      @splits_repository = SplitsRepository.new(@cache_adapter, @config)
      @segments_repository = SegmentsRepository.new(@cache_adapter, @config)
      @impressions_repository = ImpressionsRepository.new(@config.impressions_adapter, @config)
      @metrics_repository = MetricsRepository.new(@config.metrics_adapter, @config)

      @sdk_blocker = SDKBlocker.new(@config, @splits_repository, @segments_repository)
      @adapter = start!

      @client = SplitClient.new(@api_key, @config, @adapter, @splits_repository, @segments_repository, @impressions_repository, @metrics_repository)
      @manager = SplitManager.new(@api_key, @config, @adapter, @splits_repository)

      @sdk_blocker.block if @config.block_until_ready > 0
    end

    def start!
      SplitAdapter.new(@api_key, @config, @splits_repository, @segments_repository, @impressions_repository, @metrics_repository, @sdk_blocker)
    end

    alias resume! start!
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
splitclient-rb-4.3.2 lib/splitclient-rb/split_factory.rb
splitclient-rb-4.3.1 lib/splitclient-rb/split_factory.rb
splitclient-rb-4.3.0 lib/splitclient-rb/split_factory.rb
splitclient-rb-4.3.0.canary.2 lib/splitclient-rb/split_factory.rb
splitclient-rb-4.3.0.canary.1 lib/splitclient-rb/split_factory.rb
splitclient-rb-4.2.2 lib/splitclient-rb/split_factory.rb
splitclient-rb-4.2.1 lib/splitclient-rb/split_factory.rb
splitclient-rb-4.2.0 lib/splitclient-rb/split_factory.rb
splitclient-rb-4.1.0 lib/splitclient-rb/split_factory.rb
splitclient-rb-4.1.0.pre.rc2 lib/splitclient-rb/split_factory.rb
splitclient-rb-4.1.0.pre.rc1 lib/splitclient-rb/split_factory.rb
splitclient-rb-4.0.0 lib/splitclient-rb/split_factory.rb
splitclient-rb-4.0.0.pre.rc1 lib/splitclient-rb/split_factory.rb
splitclient-rb-3.3.0 lib/splitclient-rb/split_factory.rb
splitclient-rb-3.3.0.pre.rc1 lib/splitclient-rb/split_factory.rb
splitclient-rb-3.2.4 lib/splitclient-rb/split_factory.rb
splitclient-rb-3.2.4.pre.rc5 lib/splitclient-rb/split_factory.rb
splitclient-rb-3.2.4.pre.rc4 lib/splitclient-rb/split_factory.rb
splitclient-rb-3.2.4.pre.rc3 lib/splitclient-rb/split_factory.rb
splitclient-rb-3.2.4.pre.rc2 lib/splitclient-rb/split_factory.rb