Sha256: b9d323ecdbe978e323b0b87ebaba49181717aa4d8499fd3477390cdd37600549

Contents?: true

Size: 485 Bytes

Versions: 2

Compression:

Stored size: 485 Bytes

Contents

# frozen_string_literal: true

require_relative "session"
module HTTPX
  class Session
    def initialize(options = EMPTY_HASH, &blk)
      @options = self.class.default_options.merge(options)
      @responses = {}
      @persistent = @options.persistent
      wrap(&blk) if block_given?
    end

    def wrap
      begin
        prev_persistent = @persistent
        @persistent = true
        yield self
      ensure
        @persistent = prev_persistent
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
httpx-0.17.0 lib/httpx/session2.rb
httpx-0.16.1 lib/httpx/session2.rb