class LabelDefinitions::Label
Attributes
column_gutter[R]
columns[R]
height[R]
name[R]
row_gutter[R]
rows[R]
width[R]
Public Class Methods
new(attributes = {})
click to toggle source
# File lib/label_definitions/label.rb, line 5 def initialize(attributes = {}) @name = attributes.fetch(:name) @rows = attributes.fetch(:rows).to_i @columns = attributes.fetch(:columns).to_i @width = attributes.fetch(:width).to_f @height = attributes.fetch(:height).to_f @row_gutter = attributes.fetch(:row_gutter).to_f @column_gutter = attributes.fetch(:column_gutter).to_f @page_width = attributes.fetch(:page_width).to_f @page_height = attributes.fetch(:page_height).to_f end
Public Instance Methods
page()
click to toggle source
# File lib/label_definitions/label.rb, line 17 def page @page ||= Page.new page_width, page_height, page_top_margin, page_left_margin end
Private Instance Methods
page_height()
click to toggle source
# File lib/label_definitions/label.rb, line 27 def page_height @page_height end
page_left_margin()
click to toggle source
# File lib/label_definitions/label.rb, line 35 def page_left_margin ( page_width - (columns * width) - ((columns-1) * column_gutter) ) / 2 end
page_top_margin()
click to toggle source
# File lib/label_definitions/label.rb, line 31 def page_top_margin ( page_height - (rows * height) - ((rows-1) * row_gutter) ) / 2 end
page_width()
click to toggle source
# File lib/label_definitions/label.rb, line 23 def page_width @page_width end