Sha256: b27e8aaf76c54f26720514f0dd2e8e6d36d50f79376c47cf5d67c9a0e4c312ee

Contents?: true

Size: 1.07 KB

Versions: 9

Compression:

Stored size: 1.07 KB

Contents

module Spontaneous::Media
  module Image
    autoload :Attributes, "spontaneous/media/image/attributes"
    autoload :Format,     "spontaneous/media/image/format"
    autoload :Optimizer,  "spontaneous/media/image/optimizer"
    autoload :Processor,  "spontaneous/media/image/processor"
    autoload :Renderable, "spontaneous/media/image/renderable"
    autoload :Skeptick,   "spontaneous/media/image/skeptick"

    def self.dimensions(file)
      new(file).dimensions
    end

    def self.type(file)
      new(file).format
    end

    def self.format(file)
      new(file).format
    end

    def self.identify(file)
      new(file)
    end

    def self.header_size
      formats.map { |magic, _| magic.length }.max
    end

    def self.peek(file)
      file.read(header_size).unpack("C*")
    end

    def self.formats
      @formats ||= {}
    end

    def self.define(ext, magic, &block)
      formats[ext] = [magic, block]
    end

    def self.new(file)
      Format.new(file)
    end
  end
end

Dir[::File.dirname(__FILE__) + "/image/format/*.rb"].each do |format|
  require format
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 lib/spontaneous/media/image.rb
spontaneous-0.2.0.beta9 lib/spontaneous/media/image.rb
spontaneous-0.2.0.beta8 lib/spontaneous/media/image.rb
spontaneous-0.2.0.beta7 lib/spontaneous/media/image.rb
spontaneous-0.2.0.beta6 lib/spontaneous/media/image.rb
spontaneous-0.2.0.beta5 lib/spontaneous/media/image.rb
spontaneous-0.2.0.beta4 lib/spontaneous/media/image.rb
spontaneous-0.2.0.beta3 lib/spontaneous/media/image.rb
spontaneous-0.2.0.beta2 lib/spontaneous/media/image.rb