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, line 154
def uploaded_file(object, &block)
  if (hash = object).is_a?(Hash) && !hash.key?("storage")
    hash.inject({}) do |result, (name, data)|
      result.update(name.to_sym => uploaded_file(data, &block))
    end
  else
    super
  end
end
version? (name)

Checks that the identifier is a registered version.

[show source]
# File lib/shrine/plugins/versions.rb, line 148
def version?(name)
  Shrine.deprecation("Shrine.version? is deprecated and will be removed in Shrine 3.")
  version_names.nil? || version_names.map(&:to_s).include?(name.to_s)
end
version_fallbacks ()
[show source]
# File lib/shrine/plugins/versions.rb, line 143
def version_fallbacks
  opts[:version_fallbacks]
end
version_names ()
[show source]
# File lib/shrine/plugins/versions.rb, line 138
def version_names
  Shrine.deprecation("Shrine.version_names is deprecated and will be removed in Shrine 3.")
  opts[:version_names]
end