Sha256: 04bab101090cb3e4a3f5a60f2a3ebd200659a77cb6aa804d21b98b928761d5ef

Contents?: true

Size: 372 Bytes

Versions: 2

Compression:

Stored size: 372 Bytes

Contents

module Locomotive::Steam::Middlewares

  class ThreadSafe

    attr_accessor_initialize :app
    attr_accessor :env

    def call(env)
      threadsafed     = dup
      threadsafed.env = env

      threadsafed._call

      threadsafed.next
    end

    def next
      # avoid to be called twice
      @next_response || (@next_response = app.call(env))
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
locomotivecms_steam-1.4.1 lib/locomotive/steam/middlewares/thread_safe.rb
locomotivecms_steam-1.4.0 lib/locomotive/steam/middlewares/thread_safe.rb