class Picturama::Picture

Attributes

metainfo[RW]
resized[RW]
thumbnail[RW]

Public Class Methods

new(args) click to toggle source
Calls superclass method
# File lib/picturama/picture.rb, line 8
def initialize(args)
  super
  @thumbnail = "#{File.dirname(path)}/thumbnails/#{Picturama::config['thumbnail_prefix']}#{basename}"
  @resized = "#{File.dirname(path)}/resized/resized_#{basename}"
  @metainfo = "#{File.dirname(path)}/resized/resized_#{basename}.info"
end

Public Instance Methods

basename() click to toggle source
# File lib/picturama/picture.rb, line 15
def basename
  File.basename(path)
end
has_resized?() click to toggle source
# File lib/picturama/picture.rb, line 23
def has_resized?
  File.exists?(@resized)
end
has_thumbnail?() click to toggle source
# File lib/picturama/picture.rb, line 27
def has_thumbnail?
  File.exists?(@thumbnail) && File.size(@thumbnail) < size
end
info() click to toggle source
# File lib/picturama/picture.rb, line 19
def info
  File.read(@metainfo) if File.exists?(@metainfo)
end
remove_assoc() click to toggle source
# File lib/picturama/picture.rb, line 31
def remove_assoc
  File.delete(@thumbnail) if has_thumbnail?
  File.delete(@resized) if has_resized?
end
type() click to toggle source
# File lib/picturama/picture.rb, line 36
def type
  File.extname(path).split('.').last
end