Class: VcrWs::ClientActorMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/vcr_ws/client_actor_middleware.rb

Class Method Summary collapse

Class Method Details

.enable_actor!Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/vcr_ws/client_actor_middleware.rb', line 5

def self.enable_actor!
  Faye::WebSocket::Client.prepend(
    Module.new do
      def initialize(url, protocols = nil, options = {})
        if VcrWs::Config.instance.vcr_enabled
          actor_url = "ws://#{VcrWs::Config.instance.test_ws_address}:#{VcrWs::Config.instance.test_ws_port}"
          super(actor_url, protocols, options)
        else
          super
        end
      end
    end
  )
end