class Prawn::ImageHandler
ImageHandler provides a way to register image processors with Prawn.
Public Class Methods
Public Instance Methods
Source
# File lib/prawn/image_handler.rb, line 52 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
Find an image handler for an image.
@param image_blob [String] @return [Object] @raise [Prawn::Errors::UnsupportedImageType] If no image handler were
found for the image.
Source
# File lib/prawn/image_handler.rb, line 24 def register(handler) @handlers.delete(handler) @handlers.push(handler) end
Register an image handler.
@param handler [Object] @return [void]
Source
# File lib/prawn/image_handler.rb, line 33 def register!(handler) @handlers.delete(handler) @handlers.unshift(handler) end
Register an image handler with the highest priority.
@param handler [Object] @return [void]
Source
# File lib/prawn/image_handler.rb, line 42 def unregister(handler) @handlers.reject! { |h| h == handler } end
Unregister an image handler.
@param handler [Object] @return [void]