Sha256: fc0e7a7f1d0bc862ba0e0041144cb269dcccf39d6b026cd77c2fb8ac7755c92b

Contents?: true

Size: 654 Bytes

Versions: 9

Compression:

Stored size: 654 Bytes

Contents

require "faraday"

class Hypernova::Configuration
  VALID_SCHEMES = [:http, :https].freeze

  attr_accessor :http_adapter,
                :http_client,
                :host,
                :open_timeout,
                :port,
                :scheme,
                :timeout

  def initialize
    @open_timeout = 0.1
    @scheme = :http
    @timeout = 0.6
  end

  def http_adapter
    @http_adapter || Faraday.default_adapter
  end

  def scheme=(value)
    validate_scheme!(value)
    @scheme = value
  end

  private

  def validate_scheme!(value)
    raise TypeError.new("Unknown scheme #{value}") unless VALID_SCHEMES.include?(value)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hypernova-2.0.0 lib/hypernova/configuration.rb
hypernova-1.4.0 lib/hypernova/configuration.rb
hypernova-1.3.0 lib/hypernova/configuration.rb
hypernova-1.2.0 lib/hypernova/configuration.rb
hypernova-1.1.0 lib/hypernova/configuration.rb
hypernova-1.0.3 lib/hypernova/configuration.rb
hypernova-1.0.2 lib/hypernova/configuration.rb
hypernova-1.0.1 lib/hypernova/configuration.rb
hypernova-1.0.0 lib/hypernova/configuration.rb