Sha256: 6885e7eae5f1b961e5e473033fd80d3c6bac476303440be83254996b0f6f5ed4

Contents?: true

Size: 724 Bytes

Versions: 7

Compression:

Stored size: 724 Bytes

Contents

# frozen_string_literal: true

module Grumlin
  class Config
    attr_accessor :url, :pool_size, :client_concurrency, :client_factory, :provider

    SUPPORTED_PROVIDERS = %i[neptune tinkergraph].freeze

    class ConfigurationError < Grumlin::Error; end

    class UnknownProviderError < ConfigurationError; end

    def initialize
      @pool_size = 10
      @client_concurrency = 5
      @provider = :tinkergraph
      @client_factory = ->(url, parent) { Grumlin::Client.new(url, parent: parent) }
    end

    def validate!
      return if SUPPORTED_PROVIDERS.include?(provider.to_sym)

      raise UnknownProviderError, "provider '#{provider}' is unknown. Supported providers: #{SUPPORTED_PROVIDERS}"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
grumlin-0.22.5 lib/grumlin/config.rb
grumlin-0.22.4 lib/grumlin/config.rb
grumlin-0.22.3 lib/grumlin/config.rb
grumlin-0.22.2 lib/grumlin/config.rb
grumlin-0.22.1 lib/grumlin/config.rb
grumlin-0.22.0 lib/grumlin/config.rb
grumlin-0.21.1 lib/grumlin/config.rb