module Shrine::Plugins::Versions::ClassMethods

  1. lib/shrine/plugins/versions.rb

Public Instance methods

uploaded_file (object, &block)

Converts a hash of data into a hash of versions.

[show source]
   # File lib/shrine/plugins/versions.rb
38 def uploaded_file(object, &block)
39   if object.is_a?(Hash) && object.values.none? { |value| value.is_a?(String) }
40     object.inject({}) do |result, (name, value)|
41       result.merge!(name.to_sym => uploaded_file(value, &block))
42     end
43   elsif object.is_a?(Array)
44     object.map { |value| uploaded_file(value, &block) }
45   else
46     super
47   end
48 end
version? (name)

Checks that the identifier is a registered version.

[show source]
   # File lib/shrine/plugins/versions.rb
32 def version?(name)
33   Shrine.deprecation("Shrine.version? is deprecated and will be removed in Shrine 3.")
34   version_names.nil? || version_names.map(&:to_s).include?(name.to_s)
35 end
version_fallbacks ()
[show source]
   # File lib/shrine/plugins/versions.rb
27 def version_fallbacks
28   opts[:version_fallbacks]
29 end
version_names ()
[show source]
   # File lib/shrine/plugins/versions.rb
22 def version_names
23   Shrine.deprecation("Shrine.version_names is deprecated and will be removed in Shrine 3.")
24   opts[:version_names]
25 end