lib/zebra/epl/label.rb in zebra-epl-0.0.2 vs lib/zebra/epl/label.rb in zebra-epl-0.0.5
- old
+ new
@@ -5,11 +5,11 @@
class Label
class InvalidPrintSpeedError < StandardError; end
class InvalidPrintDensityError < StandardError; end
class PrintSpeedNotInformedError < StandardError; end
- attr_reader :elements
+ attr_reader :elements, :tempfile
attr_accessor :width, :length, :gap, :print_speed, :print_density
def initialize(options = {})
options.each_pair { |key, value| self.__send__("#{key}=", value) if self.respond_to?("#{key}=") }
@elements = []
@@ -61,10 +61,15 @@
def persist
tempfile = Tempfile.new "zebra_label"
dump_contents tempfile
tempfile.rewind
+ @tempfile = tempfile
tempfile
+ end
+
+ def persisted?
+ !!self.tempfile
end
private
def check_required_configurations