module Shrine::Plugins::RemoteUrl::AttacherMethods

  1. lib/shrine/plugins/remote_url.rb

Methods

Public Instance

  1. assign_remote_url
  2. remote_url
  3. remote_url=

Public Instance methods

assign_remote_url(url, downloader: {}, **options)

Downloads the remote file and assigns it. If download failed, sets the error message and assigns the url to an instance variable so that it shows up in the form.

[show source]
   # File lib/shrine/plugins/remote_url.rb
87 def assign_remote_url(url, downloader: {}, **options)
88   return if url == "" || url.nil?
89 
90   downloaded_file = shrine_class.remote_url(url, **downloader)
91   attach_cached(downloaded_file, **options)
92 rescue DownloadError => error
93   errors.clear << remote_url_error_message(url, error)
94   false
95 end
remote_url()

Used by <name>_data_uri attachment method.

[show source]
    # File lib/shrine/plugins/remote_url.rb
104 def remote_url
105   @remote_url
106 end
remote_url=(url)

Used by <name>_data_uri= attachment method.

[show source]
    # File lib/shrine/plugins/remote_url.rb
 98 def remote_url=(url)
 99   assign_remote_url(url)
100   @remote_url = url
101 end