module Shrine::Plugins::RackFile::AttacherMethods
Public Instance Methods
assign(value, **options)
click to toggle source
Checks whether a file is a Rack file hash, and in that case wraps the hash in an IO-like object.
Calls superclass method
# File lib/shrine/plugins/rack_file.rb, line 27 def assign(value, **options) if rack_file?(value) assign shrine_class.rack_file(value), **options else super end end
Private Instance Methods
rack_file?(value)
click to toggle source
Returns whether a given value is a Rack uploaded file hash, by checking whether it’s a hash with ‘:tempfile` and `:name` keys.
# File lib/shrine/plugins/rack_file.rb, line 39 def rack_file?(value) value.is_a?(Hash) && value.key?(:tempfile) && value.key?(:name) end