Sha256: 3238e0f2cae389e70a111d941b9d85ec1d4e00ff7b27e04d5755373110df56f0

Contents?: true

Size: 315 Bytes

Versions: 6

Compression:

Stored size: 315 Bytes

Contents

class DefinedMiddleware
  def initialize(app)
    @app = app
  end
  def call(env)
    path = env['PATH_INFO']
    if m = path.match(/^\/const\/(.*)/)
      const = m[1]
      answer = eval("defined?(#{const})")
      answer ||= "nil"
      return [200, {}, [answer]]
    else
      @app.call(env)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
active_reload-0.6.1 test/support/defined_middleware.rb
active_reload-0.6.0 test/support/defined_middleware.rb
active_reload-0.5.0 test/support/defined_middleware.rb
active_reload-0.4.0 test/support/defined_middleware.rb
active_reload-0.3.0 test/support/defined_middleware.rb
active_reload-0.2.0 test/support/defined_middleware.rb