Sha256: e38d0b725a071f7eafb5453832c7892bf03e26d8f3e4cabd9709a77b358e190c

Contents?: true

Size: 387 Bytes

Versions: 3

Compression:

Stored size: 387 Bytes

Contents

# frozen_string_literal: true

require "rails/engine"

module PCO
  class URL
    class Engine < Rails::Engine
      class DomainMiddleware
        def initialize(app)
          @app = app
        end

        def call(env)
          PCO::URL::Engine.domain = env["SERVER_NAME"].downcase.match(/[a-z0-9-]+\.[a-z]+$/).to_s
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pco-url-2.1.3 lib/pco/url/engine/domain_middleware.rb
pco-url-2.1.2 lib/pco/url/engine/domain_middleware.rb
pco-url-2.1.1 lib/pco/url/engine/domain_middleware.rb