Sha256: 3ebee243ac2c9719dfcfbaf24a6126495cb7282a75efe5ed34377040ee71618a

Contents?: true

Size: 572 Bytes

Versions: 5

Compression:

Stored size: 572 Bytes

Contents

module WebSocket::Client::Simple
  class << self
    alias_method :real_connect, :connect

    def connect(url, options = {})
      if WebSocketVCR.configuration.hook_uris.any? { |u| url.include?(u) }
        cassette = WebSocketVCR.cassette
        live = cassette.recording?
        real_client = real_connect(url, options) if live
        fake_client = WebSocketVCR::RecordableWebsocketClient.new(cassette, live ? real_client : nil)
        yield fake_client if block_given?
        fake_client
      else
        real_connect(url, options)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple-websocket-vcr-1.0.0 lib/simple_websocket_vcr/monkey_patch.rb
simple-websocket-vcr-0.1.0 lib/simple_websocket_vcr/monkey_patch.rb
simple-websocket-vcr-0.0.7 lib/simple_websocket_vcr/monkey_patch.rb
simple-websocket-vcr-0.0.6 lib/simple_websocket_vcr/monkey_patch.rb
simple-websocket-vcr-0.0.5 lib/simple_websocket_vcr/monkey_patch.rb