Sha256: 112c753b4e57298be90849a81f67831d5cc1364ec89ad273527385d4857d2dc8

Contents?: true

Size: 722 Bytes

Versions: 1

Compression:

Stored size: 722 Bytes

Contents

# frozen_string_literal: true

class App < Sinatra::Base
  register Sinatra::Subdomain

  subdomain :foo do
    get("/") { "set: #{subdomain}" }
    get("/about") { "set: about #{subdomain}" }
  end

  subdomain "foo.bar" do
    get("/") { "multiple: #{subdomain}" }
    get("/about") { "multiple: about #{subdomain}" }
  end

  subdomain [:a, :b] do
    get("/") { "array: #{subdomain}" }
  end

  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}" }
  end

  get("/") { "root" }
  get("/about") { "about" }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sinatra-subdomain-0.4.0 test/support/app.rb