module Zebra::Zpl::Printable
Attributes
data[RW]
margin[R]
position[R]
x[R]
y[R]
Public Class Methods
new(options = {})
click to toggle source
# File lib/zebra/zpl/printable.rb, line 13 def initialize(options = {}) options.each_pair { |attribute, value| self.__send__ "#{attribute}=", value } end
Public Instance Methods
justification()
click to toggle source
# File lib/zebra/zpl/printable.rb, line 28 def justification @justification || Justification::LEFT end
justification=(just)
click to toggle source
# File lib/zebra/zpl/printable.rb, line 23 def justification=(just) Justification.validate_justification just @justification = just end
margin=(margin)
click to toggle source
# File lib/zebra/zpl/printable.rb, line 32 def margin=(margin) @margin = margin || 0 end
position=(coords)
click to toggle source
# File lib/zebra/zpl/printable.rb, line 17 def position=(coords) @position = coords @x = (@margin.nil? || @margin == 0) ? coords[0] : (@margin + coords[0]) @y = coords[1] end
rotation()
click to toggle source
# File lib/zebra/zpl/printable.rb, line 41 def rotation @rotation || Rotation::NO_ROTATION end
rotation=(rot)
click to toggle source
# File lib/zebra/zpl/printable.rb, line 36 def rotation=(rot) Rotation.validate_rotation rot @rotation = rot end
Private Instance Methods
check_attributes()
click to toggle source
# File lib/zebra/zpl/printable.rb, line 51 def check_attributes raise MissingAttributeError.new("the X value is not given") unless @x raise MissingAttributeError.new("the Y value is not given") unless @y raise MissingAttributeError.new("the data to be printed is not given") unless @data || !has_data? end
has_data?()
click to toggle source
# File lib/zebra/zpl/printable.rb, line 47 def has_data? true end