You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 31, 2023. It is now read-only.
I'm not sure exactly what this issue is (or what to do about it), but for some reason building a stack with a parameter out of a hash dies.
require 'rubygems'
require 'middleware'
class MW1
def initialize(app, value)
@app = app
@value = value
end
def call(env)
puts "before"
@value = @app.call(env)
puts "after"
end
end
@config = {'foo' => 'bar'}
var = @config[:var]
pass = Middleware::Builder.new do
use MW1, var
use MW1, 3
end
pass.call(nil)
fail = Middleware::Builder.new do
use MW1, @config['foo']
use MW1, 3
end
fail.call(nil)
output:
before
before
after
after
fail.rb:28: undefined method `[]' for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/middleware-0.1.0/lib/middleware/builder.rb:38:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/middleware-0.1.0/lib/middleware/builder.rb:38:in `initialize'
from fail.rb:27:in `new'
from fail.rb:27