module PJL

PJL generation

Example

class MyPrinter
  include PJL
  def run
    job "job-#$$" do
      rdymsg display: "wait..."
      enter :postscript do
        puts "%!PS"
        ...
      end
    end
  end
end
MyPrinter.new.run

pjl/version.rb – Name and version number

Constants

AUTHOR
DESCRIPTION
HOMEPAGE
LICENSE
NAME
SUMMARY
TEAM
VERSION

Public Instance Methods

enter(language) { || ... } click to toggle source
# File lib/pjl.rb, line 95
def enter language
  pjl :enter, language: language.to_sym
  yield
ensure
  uel
  pjl
end
iparm(p) { || ... } click to toggle source
# File lib/pjl.rb, line 67
def iparm p
  m = @m
  @m = { iparm: p.to_sym }
  yield
ensure
  @m = m
end
job(name, **kwargs) { || ... } click to toggle source
# File lib/pjl.rb, line 48
def job name, **kwargs
  print "\0"*32
  uels do
    pjl
    pjl :job, name: name, **kwargs
    yield
  ensure
    pjl :eoj, name: name
  end
end
lparm(p) { || ... } click to toggle source
# File lib/pjl.rb, line 59
def lparm p
  m = @m
  @m = { lparm: p.to_sym }
  yield
ensure
  @m = m
end
method_missing(name, *args, **kwargs, &block) click to toggle source
Calls superclass method
# File lib/pjl.rb, line 80
def method_missing name, *args, **kwargs, &block
  if block then
    super
  else
    args.each { |a|
      case a
        when String, Symbol then next
        else                     super
      end
    }
    if name.to_s =~ /\Apjl_/ then name = $'.to_sym end
    pjl name, *args, **kwargs
  end
end
noop() click to toggle source
# File lib/pjl.rb, line 75
def noop
  pjl
end
Also aliased as: nop
nop()
Alias for: noop

Private Instance Methods

pjl(*args, **kwargs) click to toggle source
# File lib/pjl.rb, line 123
def pjl *args, **kwargs
  c = Cmd.new
  args.flatten!
  args   .each { |a|   c.push   a         }
  @m    &.each { |k,v| c.pushkw k, ":", v }
  kwargs .each { |k,v| c.pushkw k, "=", v }
  puts c
end
system(*args) click to toggle source
Calls superclass method
# File lib/pjl.rb, line 132
def system *args
  super or raise "#{args.first} terminated unsuccessful: #$?"
end
uel() click to toggle source
# File lib/pjl.rb, line 105
def uel
  print "\e%-12345X"
end
uels() { || ... } click to toggle source
# File lib/pjl.rb, line 109
def uels
  uel
  yield
ensure
  uel
end