lib/zebra/zpl/label.rb in zebra-zpl-1.0.5 vs lib/zebra/zpl/label.rb in zebra-zpl-1.1.0

- old
+ new

@@ -7,38 +7,28 @@ class InvalidPrintDensityError < StandardError; end class PrintSpeedNotInformedError < StandardError; end attr_writer :copies attr_reader :elements, :tempfile - attr_accessor :width, :length, :gap, :print_speed, :print_density + attr_accessor :width, :length, :print_speed def initialize(options = {}) options.each_pair { |key, value| self.__send__("#{key}=", value) if self.respond_to?("#{key}=") } @elements = [] end - def length_and_gap=(length_and_gap) - self.length = length_and_gap[0] - self.gap = length_and_gap[1] - end - def print_speed=(s) raise InvalidPrintSpeedError unless (0..6).include?(s) @print_speed = s end - def print_density=(d) - raise InvalidPrintDensityError unless (0..15).include?(d) - @print_density = d - end - def copies @copies || 1 end def <<(element) - element.width = self.width + element.width = self.width if element.respond_to?("width=") && element.width.nil? elements << element end def dump_contents(io = STDOUT) check_required_configurations @@ -73,10 +63,9 @@ # End format io << "^XZ" end def persist - # debugger tempfile = Tempfile.new "zebra_label" dump_contents tempfile tempfile.close @tempfile = tempfile tempfile