Sha256: c95297c4ae561015ca7f977ffb4f5aad886d235ff6669d747f773062222ad0a1
Contents?: true
Size: 900 Bytes
Versions: 1
Compression:
Stored size: 900 Bytes
Contents
# ImageHandler provides a way to register image processors with Prawn # # Contributed by Evan Sharp in November 2013. # # This is free software. Please see the LICENSE and COPYING files for details. module Prawn # @group Extension API def self.image_handler @image_handler ||= ImageHandler.new end class ImageHandler def initialize @handlers = [] end def register(handler) @handlers.delete(handler) @handlers.push handler end def register!(handler) @handlers.delete(handler) @handlers.unshift handler end def unregister(handler) @handlers.reject!{ |h| h == handler } end def find(image_blob) handler = @handlers.find{ |h| h.can_render? image_blob } return handler if handler raise Prawn::Errors::UnsupportedImageType, "image file is an unrecognised format" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
prawn-1.0.0 | lib/prawn/image_handler.rb |