Sha256: f5f215448aad06968585b848024806b91f232cfc4092c7ce355447dc4f8cfe64

Contents?: true

Size: 443 Bytes

Versions: 2

Compression:

Stored size: 443 Bytes

Contents

module Neoid
  class Middleware
    def initialize(app)
      @app = app
    end

    def call(env)
      old_enabled, Thread.current[:neoid_enabled] = Thread.current[:neoid_enabled], true
      old_batch, Thread.current[:neoid_current_batch] = Thread.current[:neoid_current_batch], nil
      @app.call(env)
    ensure
      Thread.current[:neoid_enabled] = old_enabled
      Thread.current[:neoid_current_batch] = old_batch
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
neoid-0.2.1 lib/neoid/middleware.rb
neoid-0.2.0 lib/neoid/middleware.rb