module Shrine::Plugins::DownloadEndpoint::ClassMethods

  1. lib/shrine/plugins/download_endpoint.rb

Public Instance methods

assign_download_endpoint (klass)

Assigns the subclassed endpoint as the DownloadEndpoint constant.

[show source]
# File lib/shrine/plugins/download_endpoint.rb, line 93
def assign_download_endpoint(klass)
  endpoint_class = Class.new(klass)
  endpoint_class.opts[:shrine_class] = self
  endpoint_class.opts[:disposition]  = opts[:download_endpoint_disposition]

  @download_endpoint = endpoint_class

  const_set(:DownloadEndpoint, endpoint_class)
  deprecate_constant(:DownloadEndpoint) if RUBY_VERSION > "2.3"
end
download_endpoint ()

Returns the Rack application that retrieves requested files.

[show source]
# File lib/shrine/plugins/download_endpoint.rb, line 88
def download_endpoint
  @download_endpoint
end
download_endpoint_serializer ()
[show source]
# File lib/shrine/plugins/download_endpoint.rb, line 104
def download_endpoint_serializer
  @download_endpoint_serializer ||= Serializer.new
end
inherited (subclass)

Assigns the subclass a copy of the download endpoint class.

[show source]
# File lib/shrine/plugins/download_endpoint.rb, line 82
def inherited(subclass)
  super
  subclass.assign_download_endpoint(@download_endpoint)
end