Class: LabelFactory::Layout::Base
- Inherits:
-
Object
- Object
- LabelFactory::Layout::Base
- Includes:
- XML::Mapping
- Defined in:
- lib/label_factory/layout/base.rb
Instance Method Summary collapse
- #as_pts(attr = nil) ⇒ Object
- #get_x(position = 0) ⇒ Object
- #get_y(position = 0) ⇒ Object
- #labels_base_per_page ⇒ Object
- #labels_per_page ⇒ Object
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_page ⇒ Object
19 20 21 |
# File 'lib/label_factory/layout/base.rb', line 19 def labels_base_per_page labels_per_page - 1 end |
#labels_per_page ⇒ Object
15 16 17 |
# File 'lib/label_factory/layout/base.rb', line 15 def labels_per_page [nx, ny].reduce(:*) end |