Module: Shrine::Plugins::Versions::AttacherMethods
- Defined in:
- lib/shrine/plugins/versions.rb
Instance Method Summary collapse
-
#url(version = nil, **options) ⇒ Object
Smart versioned URLs, which include the version name in the default URL, and properly forwards any options to the underlying storage.
Instance Method Details
#url(version = nil, **options) ⇒ Object
Smart versioned URLs, which include the version name in the default URL, and properly forwards any options to the underlying storage.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/shrine/plugins/versions.rb', line 103 def url(version = nil, **) = get if .is_a?(Hash) if version version = version.to_sym if .key?(version) [version].url(**) elsif fallback = shrine_class.version_fallbacks[version] url(fallback, **) else default_url(**, version: version) end else raise Error, "must call Shrine::Attacher#url with the name of the version" end else if version if && fallback_to_original? .url(**) else default_url(**, version: version) end else super(**) end end end |