Class: RGhost::Barcode::Guard

Inherits:
Parameter
  • Object
show all
Defined in:
lib/rghost_barcode/rghost_barcode_base.rb

Overview

Display whitespace guards or the specified width and height, in points. (Most useful for EANs). It’s used on the contructor of the class RGhost::Barcode::Base(parent of all barcodes) by Hash :guard. Between parenthesis the original parameter.

  • :whitespace(guardwhitespace) - Enabled by true. Example: :whitespace => true

  • :height and :width (guardwidth and guardheight)

Amount of whitespace to guard to left and right of the symbol and vertical position of the guard symbols, in points.

  • :left,right,:left_y, :right_y (guardleftpos, guardrightpos, guardleftypos and guardrightypos)

Example: doc=Document.new doc.barcode_ean13(‘977147396801’, :guard=>{:whitespace => true, :width => 0.2 })

Instance Method Summary collapse

Instance Method Details

#makeObject



88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/rghost_barcode/rghost_barcode_base.rb', line 88

def make
  #
  @options.each do |key,value| 
    case key
    when :left,:right,:left_y, :right_y then add("guard#{key.to_s.gsub(/_/,'')}pos",value)  
    when :whitespace then add_single("guardwhitespace")
    else
      add("guard#{key}",value)
    end
  end
  
end