Class: Prawn::ImageHandler
- Inherits:
-
Object
- Object
- Prawn::ImageHandler
- Defined in:
- lib/prawn/image_handler.rb
Overview
ImageHandler provides a way to register image processors with Prawn.
Extension API collapse
-
#find(image_blob) ⇒ Object
Find an image handler for an image.
-
#register(handler) ⇒ void
Register an image handler.
-
#register!(handler) ⇒ void
Register an image handler with the highest priority.
-
#unregister(handler) ⇒ void
Unregister an image handler.
Instance Method Details
#find(image_blob) ⇒ Object
Find an image handler for an image.
Source Code
lib/prawn/image_handler.rb, line 52
52 | def find(image_blob) |
53 | handler = @handlers.find { |h| h.can_render?(image_blob) } |
54 | |
55 | return handler if handler |
56 | |
57 | raise Prawn::Errors::UnsupportedImageType, |
58 | 'image file is an unrecognised format'
|
59 | end
|
#register(handler) ⇒ void
This method returns an undefined value.
Register an image handler.
Source Code
lib/prawn/image_handler.rb, line 24
24 | def register(handler) |
25 | @handlers.delete(handler) |
26 | @handlers.push(handler) |
27 | end
|
#register!(handler) ⇒ void
This method returns an undefined value.
Register an image handler with the highest priority.
Source Code
lib/prawn/image_handler.rb, line 33
33 | def register!(handler) |
34 | @handlers.delete(handler) |
35 | @handlers.unshift(handler) |
36 | end
|
#unregister(handler) ⇒ void
This method returns an undefined value.
Unregister an image handler.
Source Code
lib/prawn/image_handler.rb, line 42
42 | def unregister(handler) |
43 | @handlers.reject! { |h| h == handler } |
44 | end
|