Class: Pdfmult::Layout

Inherits:
Object
  • Object
show all
Defined in:
lib/pdfmult.rb

Overview

Class for the page layout.

Create an instance with Layout.new, specifying the number of pages to put on one page. Layout#geometry returns the geometry string.

Constant Summary collapse

GEOMETRY =
{
  2 => "2x1",
  4 => "2x2",
  8 => "4x2",
  9 => "3x3",
  16 => "4x4"
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pages) ⇒ Layout

Returns a new instance of Layout.



173
174
175
176
# File 'lib/pdfmult.rb', line 173

def initialize(pages)
  @pages = pages
  @geometry = GEOMETRY[pages]
end

Instance Attribute Details

#geometryObject (readonly)

Returns the value of attribute geometry.



163
164
165
# File 'lib/pdfmult.rb', line 163

def geometry
  @geometry
end

#pagesObject (readonly)

Returns the value of attribute pages.



163
164
165
# File 'lib/pdfmult.rb', line 163

def pages
  @pages
end

Instance Method Details

#landscape?Boolean

Returns:

  • (Boolean)


178
179
180
# File 'lib/pdfmult.rb', line 178

def landscape?
  %w[2x1 4x2].include?(geometry)
end