test/support/app.rb in sinatra-subdomain-0.3.0 vs test/support/app.rb in sinatra-subdomain-0.4.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
class App < Sinatra::Base
register Sinatra::Subdomain
subdomain :foo do
get("/") { "set: #{subdomain}" }
@@ -13,11 +15,15 @@
subdomain [:a, :b] do
get("/") { "array: #{subdomain}" }
end
- subdomain /\A(c|d)\z/ do
+ subdomain(/\A(c|d)\z/) do
get("/") { "regex: #{subdomain}" }
+ end
+
+ subdomain(->(actual) { actual == "e" }) do
+ get("/") { "proc: #{subdomain}" }
end
subdomain do
get("/") { "any: #{subdomain}" }
get("/about") { "any: about #{subdomain}" }