2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-11-18 11:30:21 +01:00
|
|
|
class ActiveStorage::FakeAttachment < Hashie::Dash
|
|
|
|
property :filename
|
|
|
|
property :name
|
|
|
|
property :file
|
|
|
|
property :id
|
|
|
|
property :created_at
|
|
|
|
property :record_type, default: 'Fake'
|
|
|
|
|
|
|
|
def download
|
|
|
|
file.read
|
|
|
|
end
|
|
|
|
|
|
|
|
def read(*args)
|
|
|
|
file.read(*args)
|
|
|
|
end
|
|
|
|
|
|
|
|
def close
|
|
|
|
file.close
|
|
|
|
end
|
|
|
|
|
|
|
|
def attached?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|