Class: Rabbit::Renderer::PrintLayout
- Inherits:
-
Object
- Object
- Rabbit::Renderer::PrintLayout
- Defined in:
- lib/rabbit/renderer/print-layout.rb,
lib/rabbit/renderer/print-layout.rb
Direct Known Subclasses
Constant Summary collapse
- MAPPING =
[ [1, PrintLayout1], [2, PrintLayout2], [3..(1.0/0), PrintLayoutMore], ]
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(renderer, canvas) ⇒ PrintLayout
constructor
A new instance of PrintLayout.
Constructor Details
#initialize(renderer, canvas) ⇒ PrintLayout
Returns a new instance of PrintLayout.
35 36 37 38 39 40 41 42 |
# File 'lib/rabbit/renderer/print-layout.rb', line 35 def initialize(renderer, canvas) @renderer = renderer @canvas = canvas @margin_left = renderer.margin_left @margin_right = renderer.margin_right @margin_top = renderer.margin_top @margin_bottom = renderer.margin_bottom end |
Class Method Details
.create(renderer, canvas) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rabbit/renderer/print-layout.rb', line 23 def create(renderer, canvas) map = MAPPING.find do |key, value| key === renderer. end if map.nil? raise InvalidPages.new(renderer.) else map[1].new(renderer, canvas) end end |