class Zebra::Zpl::Box

Attributes

box_height[R]
box_width[R]
color[R]
line_thickness[R]
rounding_degree[R]
width[R]

Public Instance Methods

box_height=(height) click to toggle source
# File lib/zebra/zpl/box.rb, line 28
def box_height=(height)
  @box_height = height
end
box_width=(width) click to toggle source
# File lib/zebra/zpl/box.rb, line 19
def box_width=(width)
  @box_width = width
end
color=(value) click to toggle source
# File lib/zebra/zpl/box.rb, line 37
def color=(value)
  raise InvalidColorError unless %w[B W].include?(value&.upcase)
  @color = value
end
line_thickness=(thickness) click to toggle source
# File lib/zebra/zpl/box.rb, line 14
def line_thickness=(thickness)
  raise InvalidLineThickness unless thickness.nil? || thickness.to_i.to_s == thickness.to_s
  @line_thickness = thickness
end
rounding_degree=(value) click to toggle source
# File lib/zebra/zpl/box.rb, line 32
def rounding_degree=(value)
  raise InvalidLineThickness unless (1..8).include?(value.to_i)
  @rounding_degree = value
end
to_zpl() click to toggle source
# File lib/zebra/zpl/box.rb, line 42
def to_zpl
  check_attributes
  puts "The Box class is deprecated. Please switch to the Graphic class (graphic_type = box)." unless ENV['RUBY_ENV'] == 'test'
  "^FO#{x},#{y}^GB#{box_width},#{box_height},#{line_thickness},#{color},#{rounding_degree}^FS"
end
width=(width) click to toggle source

The method below refers to the “label width”

# File lib/zebra/zpl/box.rb, line 24
def width=(width)
  @width = width || 0
end

Private Instance Methods

check_attributes() click to toggle source
Calls superclass method Zebra::Zpl::Printable#check_attributes
# File lib/zebra/zpl/box.rb, line 54
def check_attributes
  super
  raise MissingAttributeError.new("the line thickness is not given") unless line_thickness
  raise MissingAttributeError.new("the box_width is not given") unless box_width
  raise MissingAttributeError.new("the box_height is not given") unless box_height
end
has_data?() click to toggle source
# File lib/zebra/zpl/box.rb, line 50
def has_data?
  false
end