Class: LabelFactory::Label::Base

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

Direct Known Subclasses

Cd, Rectangle, Round

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#shapeObject

Returns the value of attribute shape.



6
7
8
# File 'lib/label_factory/label/base.rb', line 6

def shape
  @shape
end

Instance Method Details

#draw_markups!(pdf_instance = nil, box_x, box_y) ⇒ Object



20
21
22
23
24
25
# File 'lib/label_factory/label/base.rb', line 20

def draw_markups!(pdf_instance = nil, box_x, box_y)
  if pdf_instance
    draw_margins!(pdf_instance, box_x, box_y)
    draw_lines!(pdf_instance, box_x, box_y)
  end
end

#markupsObject



16
17
18
# File 'lib/label_factory/label/base.rb', line 16

def markups
  @markups ||= [@markupMargins, @markupLines, @markupCircles ].reduce(:merge)
end

#without_margins(x, y, offset_x = nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/label_factory/label/base.rb', line 27

def without_margins(x, y, offset_x = nil)
  width = x + self.width.as_pts
  width += offset_x if offset_x
  @markupMargins.each do |margin|
    x += margin.size.as_pts
    y -= margin.size.as_pts
    width -= margin.size.as_pts
  end
  [x, y, width]
end