Sha256: 26ed3a5da0af2ec3e37c7cf8a1d01a22f7ab6edc2cb959558c2d0cb26488c856

Contents?: true

Size: 770 Bytes

Versions: 62

Compression:

Stored size: 770 Bytes

Contents

#
# This adds basic support for running +#call+ on the +url_host+
# configuration given to Dragonfly during app initialization. It's
# currently an open pull request on markevans/dragonfly, but it doesn't
# seem likely that it will be merged anytime soon. However, if this does
# become a feature of Dragonfly in the future, the following code can be
# removed from our platform after we upgrade to the newest version.
#
# PR: https://github.com/markevans/dragonfly/pull/502
#
decorate Dragonfly::Server do
  decorated do
    attr_writer :url_host
  end

  def call(env)
    @request = Rack::Request.new(env)
    super
  end

  def url_host
    if !@url_host.nil? && @url_host.respond_to?(:call)
      @url_host.call(@request)
    else
      @url_host
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.4.13 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.12 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb