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.5.27 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.26 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.45 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.25 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.23 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.44 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.22 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.43 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.21 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.42 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.20 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.41 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.19 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.40 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.18 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.39 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.17 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.38 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.16 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.37 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb