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 180
def uploaded_file(object, &block)
  if object.is_a?(Hash) && object.values.none? { |value| value.is_a?(String) }
    object.inject({}) do |result, (name, value)|
      result.merge!(name.to_sym => uploaded_file(value, &block))
    end
  elsif object.is_a?(Array)
    object.map { |value| uploaded_file(value, &block) }
  else
    super
  end
end
version? (name)

Checks that the identifier is a registered version.

[show source]
# File lib/shrine/plugins/versions.rb, line 174
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 169
def version_fallbacks
  opts[:version_fallbacks]
end
version_names ()
[show source]
# File lib/shrine/plugins/versions.rb, line 164
def version_names
  Shrine.deprecation("Shrine.version_names is deprecated and will be removed in Shrine 3.")
  opts[:version_names]
end