Class: AttachmentSan::Variant::Original
Instance Attribute Summary
#record, #reflection
Instance Method Summary
collapse
#base_options, #base_path, #dir_path, #extension, #file_path, #filename_scheme, #filename_with_variant_name, #initialize, #mkdir!, #name, #public_base_path, #public_path, #token
Instance Method Details
#filename ⇒ Object
148
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/attachment_san/variant.rb', line 148
def filename
@filename ||=
case filename_scheme
when :token
File.join(token, @record.filename)
when :keep_original
@record.filename
else
super
end
end
|
#original ⇒ Object
144
145
146
|
# File 'lib/attachment_san/variant.rb', line 144
def original
self
end
|
#process! ⇒ Object
160
161
162
163
164
|
# File 'lib/attachment_san/variant.rb', line 160
def process!
return super if @reflection[:process]
mkdir!
File.open(file_path, 'w') { |f| f.write @record.uploaded_file.read }
end
|