Sha256: a1ccba17ade490c53f4f4b48f8c1b2d8f63c71220e226fe1e809b9a4871d1b22
Contents?: true
Size: 542 Bytes
Versions: 1
Compression:
Stored size: 542 Bytes
Contents
require "tempfile" require "fileutils" require "delegate" module SocialAvatarProxy class AvatarFile < SimpleDelegator attr_reader :file def initialize(path) if File.exist?(path) @file = File.new(path) mtime(file.mtime) else @file = Tempfile.new(path.gsub("/", "-")) end super(file) end def mtime(value = nil) value ? @mtime = value.to_i : Time.at(@mtime) end def content_type(value = nil) value ? @content_type = value : @content_type end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
social-avatar-proxy-2.0.0 | lib/social_avatar_proxy/avatar_file.rb |