Class: Locomotive::Steam::Middlewares::ThreadSafe

Inherits:
Object
  • Object
show all
Defined in:
lib/locomotive/steam/middlewares/thread_safe.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#envObject

Returns the value of attribute env.



6
7
8
# File 'lib/locomotive/steam/middlewares/thread_safe.rb', line 6

def env
  @env
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/locomotive/steam/middlewares/thread_safe.rb', line 8

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

  threadsafed._call

  threadsafed.next
end

#nextObject



17
18
19
20
# File 'lib/locomotive/steam/middlewares/thread_safe.rb', line 17

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