Class: LabelDefinitions::Label

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

Defined Under Namespace

Classes: Page

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Label



5
6
7
8
9
10
11
12
13
14
15
# 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

Instance Attribute Details

#column_gutterObject (readonly)

Returns the value of attribute column_gutter.



3
4
5
# File 'lib/label_definitions/label.rb', line 3

def column_gutter
  @column_gutter
end

#columnsObject (readonly)

Returns the value of attribute columns.



3
4
5
# File 'lib/label_definitions/label.rb', line 3

def columns
  @columns
end

#heightObject (readonly)

Returns the value of attribute height.



3
4
5
# File 'lib/label_definitions/label.rb', line 3

def height
  @height
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/label_definitions/label.rb', line 3

def name
  @name
end

#row_gutterObject (readonly)

Returns the value of attribute row_gutter.



3
4
5
# File 'lib/label_definitions/label.rb', line 3

def row_gutter
  @row_gutter
end

#rowsObject (readonly)

Returns the value of attribute rows.



3
4
5
# File 'lib/label_definitions/label.rb', line 3

def rows
  @rows
end

#widthObject (readonly)

Returns the value of attribute width.



3
4
5
# File 'lib/label_definitions/label.rb', line 3

def width
  @width
end

Instance Method Details

#pageObject



17
18
19
# File 'lib/label_definitions/label.rb', line 17

def page
  @page ||= Page.new page_width, page_height, page_top_margin, page_left_margin
end