class Languages::Epl2
Public Class Methods
new(data=nil)
click to toggle source
# File lib/languages/epl2.rb, line 11 def initialize(data=nil) @data = data @document = Epl2::Document.new #defaults @font = Epl2::Font.new @position = Epl2::Position[0,0] end
Public Instance Methods
barcode(*args)
click to toggle source
# File lib/languages/epl2.rb, line 55 def barcode(*args) opts = args.extract_options! code,text = args.pop 2 opts = opts.merge({:font => font,:text =>text}) if opts.include? :at opts[:at] = (@position + Epl2::Position.from_array(opts[:at])).to_a end b = Epl2::BarcodeFactory.create_barcode code,opts @document << b.render end
data()
click to toggle source
# File lib/languages/epl2.rb, line 79 def data @data end
document()
click to toggle source
# File lib/languages/epl2.rb, line 19 def document @document.render end
font(opts={},&block)
click to toggle source
# File lib/languages/epl2.rb, line 43 def font(opts={},&block) if opts.include? :size @font = Epl2::Font.new(opts) end if block_given? save = @font @font = Epl2::Font.new(opts) self.instance_eval(&block) @font = save end end
position(x,y,&block)
click to toggle source
# File lib/languages/epl2.rb, line 68 def position(x,y,&block) if block_given? save = @position @position = Epl2::Position[x,y] self.instance_eval(&block) @position = save else @position = Epl2::Position[x,y] end end
rotate(amount,&block)
click to toggle source
# File lib/languages/epl2.rb, line 32 def rotate(amount,&block) if block_given? save = @font @font.font_rotation amount self.instance_eval(&block) @font = save else @font.font_rotation amount end end
text(value,opts={})
click to toggle source
# File lib/languages/epl2.rb, line 23 def text(value,opts={}) if opts.include? :at opts[:at] = (@position + Epl2::Position.from_array(opts[:at])).to_a else opts[:at] = @position.to_a end @document << Epl2::Text.new(:font => @font, :at => opts[:at], :text => value) end