Sha256: ddc97051c3c831b9ccb42b9488bf1e120938d06f0c6611531b44ccf91fedb262

Contents?: true

Size: 977 Bytes

Versions: 22

Compression:

Stored size: 977 Bytes

Contents

require "forwardable"
require "tempfile"
require 'thread'

require 'rabbit/utils'

dir = File.join("rabbit", "image")
Rabbit::Utils.require_files_under_directory_in_load_path(dir)

module Rabbit
  module ImageManipulable
    extend Forwardable

    def_delegators(:@loader, :keep_ratio, :keep_ratio=)
    def_delegators(:@loader, :x_aspect_ratio, :y_aspect_ratio)
    def_delegators(:@loader, :pixbuf, :width, :height)
    def_delegators(:@loader, :original_width, :original_height)
    def_delegators(:@loader, :resize, :draw)
    def_delegators(:@loader, :[], :[]=)
    alias_method :scale, :resize

    def initialize(filename, props=nil, *args, &block)
      unless File.exist?(filename)
        raise ImageFileDoesNotExistError.new(filename)
      end
      super(*args, &block)
      props = Utils.stringify_hash_key(props) if props
      @loader = Base.find_loader(filename).new(filename, props)
    end
  end

  class ImageLoader
    include ImageManipulable
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rabbit-2.2.1 lib/rabbit/image.rb
rabbit-2.2.0 lib/rabbit/image.rb
rabbit-2.1.9 lib/rabbit/image.rb
rabbit-2.1.8 lib/rabbit/image.rb
rabbit-2.1.7 lib/rabbit/image.rb
rabbit-2.1.6 lib/rabbit/image.rb
rabbit-2.1.5 lib/rabbit/image.rb
rabbit-2.1.4 lib/rabbit/image.rb
rabbit-2.1.3 lib/rabbit/image.rb
rabbit-2.1.2 lib/rabbit/image.rb
rabbit-2.1.1 lib/rabbit/image.rb
rabbit-2.1.0 lib/rabbit/image.rb
rabbit-2.0.9 lib/rabbit/image.rb
rabbit-2.0.8 lib/rabbit/image.rb
rabbit-2.0.7 lib/rabbit/image.rb
rabbit-2.0.6 lib/rabbit/image.rb
rabbit-2.0.5 lib/rabbit/image.rb
rabbit-2.0.4 lib/rabbit/image.rb
rabbit-2.0.3 lib/rabbit/image.rb
rabbit-2.0.2 lib/rabbit/image.rb