Sha256: 1aef79a2f6770b7647e15beb9a6e0bcdb0359c7e5ce118bcea991b91bf75dcb2
Contents?: true
Size: 983 Bytes
Versions: 53
Compression:
Stored size: 983 Bytes
Contents
module Burp class FileModel attr_accessor :public_path def initialize(public_path) self.public_path = public_path end def self.all @file_paths = Dir.glob("#{Burp.content_directory}uploads/*").select{|path| File.file?(path) } @file_paths = @file_paths.map {|path| path.gsub("#{Burp.content_directory}uploads/","/burp/files/") } @file_paths.map {|path| FileModel.new(path)}.sort.reverse end def to_param public_path end def on_disk_path public_path.gsub("/burp/files/","#{Burp.content_directory}uploads/") end def mtime @mtime_cache ||= File.mtime(on_disk_path) end def size @size_cache ||= File.size(on_disk_path) end def <=>(other) other.is_a?(FileModel) ? self.mtime <=> other.mtime : 0 end def eql?(other) self.class == other.class && self.hash == other.hash end def hash public_path.hash end end end
Version data entries
53 entries across 53 versions & 1 rubygems