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.15 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.36 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.14 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.35 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.13 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.34 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.12 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.33 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.11 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.10 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.32 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.9 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.31 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.8 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.30 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.7 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.29 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.6 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.4.28 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb
workarea-core-3.5.5 lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb