class Thumbnailer::File

Attributes

path[R]

Public Class Methods

new(path, options = {}) click to toggle source
Calls superclass method Thumbnailer::Base::new
# File lib/thumbnailer/file.rb, line 5
def initialize(path, options = {})
  super(options)
  @path    = path
  @file    = @options[:file]
  @file    = ::File.basename(@path) if @file.nil? && !@path.nil?
  @dir     = @options[:dir]
  @dir     = ::File.dirname(@path) if @dir.nil? && !@path.nil?
  @prefix  = @options[:prefix] if @options[:prefix]
  @object  = extract_image(@path) if !@options[:object]
end

Private Instance Methods

extract_image(file) click to toggle source
# File lib/thumbnailer/file.rb, line 18
def extract_image(file)
  raise Errno::ENOENT unless ::File.exist?(file)
  @object = ::MiniMagick::Image.open(file)
  extract_image_size
  @object
end