Class: LabelFactory::Layout::Base

Inherits:
Object
  • Object
show all
Includes:
XML::Mapping
Defined in:
lib/label_factory/layout/base.rb

Instance Method Summary collapse

Instance Method Details

#as_pts(attr = nil) ⇒ Object



23
24
25
# File 'lib/label_factory/layout/base.rb', line 23

def as_pts(attr = nil)
  self.public_send(attr.to_s).as_pts if attr
end

#get_x(position = 0) ⇒ Object



27
28
29
# File 'lib/label_factory/layout/base.rb', line 27

def get_x(position = 0)
  (position * 1.0 / ny).floor
end

#get_y(position = 0) ⇒ Object



31
32
33
# File 'lib/label_factory/layout/base.rb', line 31

def get_y(position = 0)
  position % ny
end

#labels_base_per_pageObject



19
20
21
# File 'lib/label_factory/layout/base.rb', line 19

def labels_base_per_page
  labels_per_page - 1
end

#labels_per_pageObject



15
16
17
# File 'lib/label_factory/layout/base.rb', line 15

def labels_per_page
  [nx, ny].reduce(:*)
end