lib/rack/when/builder.rb in rack-when-0.0.2 vs lib/rack/when/builder.rb in rack-when-0.0.3

- old
+ new

@@ -1,18 +1,18 @@ module Rack module When class Builder - def initialize env, block - @env, @block = env, block + def initialize *args + *@envs, @block = args end def mount @block.call if has_matching_env? end def has_matching_env? - (ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development') =~ /^#{@env.to_s.downcase}/ + @envs.any? { |env| (ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development') =~ /^#{env.to_s.downcase}/ } end end end end