mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
0b87e7543f
Rolling out frozen string literals further by freezing all string literals in core specs.
30 lines
537 B
Ruby
30 lines
537 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UploadedFile
|
|
attr_reader :pathname
|
|
|
|
def initialize(pathname)
|
|
@pathname = pathname
|
|
end
|
|
|
|
def path
|
|
pathname.to_s
|
|
end
|
|
|
|
def to_s
|
|
path
|
|
end
|
|
|
|
def basename
|
|
File.basename(path)
|
|
end
|
|
|
|
def self.load_from(path)
|
|
full_path = Rails.root.join(path)
|
|
shared_path = DownloadList::SHARED_PATH.join(File.basename(full_path))
|
|
# with remote drivers, files to upload must be in the shared downloads folder
|
|
FileUtils.cp(full_path, shared_path)
|
|
new(shared_path)
|
|
end
|
|
end
|