Sha256: 2466fc3065ac8b985bbacc6d74a62143650b38266dbdf5034c329f76c2d99f9d
Contents?: true
Size: 866 Bytes
Versions: 4
Compression:
Stored size: 866 Bytes
Contents
module Picasa class File class Null def path; end def name; end def extension; end def binary; end def content_type; end end attr_reader :path def initialize(path) @path = path || raise(ArgumentError.new("path not specified")) end def name @name ||= ::File.basename(path, ".*") end def extension @extension ||= ::File.extname(path)[1..-1] end def binary @binary ||= ::File.open(path, "rb").read end def content_type @content_type ||= case extension when /^jpe?g$/i "image/jpeg" when /^gif$/i "image/gif" when /^png$/i "image/png" when /^bmp$/i "image/bmp" else raise StandarError.new("Content type cannot be guessed from file extension: #{extension}") end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
picasa-0.6.3 | lib/picasa/file.rb |
picasa-0.6.2 | lib/picasa/file.rb |
picasa-0.6.1 | lib/picasa/file.rb |
picasa-0.6.0 | lib/picasa/file.rb |