Module: PJL

Included in:
PjlAppl
Defined in:
lib/pjl.rb,
lib/pjl/version.rb

Overview

pjl/version.rb – Name and version number

Constant Summary collapse

NAME =
"pjl"
VERSION =
"1.2.2".freeze
SUMMARY =
"PJL generation"
DESCRIPTION =
<<EOT
Write PJL (Printer Job Language) commands from a Ruby program.
EOT
"(C) 2013-2018 Bertram Scharpf"
LICENSE =
"BSD-2-Clause"
AUTHOR =
"Bertram Scharpf <[email protected]>"
TEAM =
[ "Bertram Scharpf"]
HOMEPAGE =
"http://www.bertram-scharpf.de/software/pjl"

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/pjl.rb', line 82

def method_missing name, *args, &block
  if block then
    super
  else
    args.each { |a|
      case a
        when String, Symbol, Hash then next
        else                           super
      end
    }
    if name.to_s =~ /\Apjl_/ then name = $'.to_sym end
    pjl name, *args
  end
end

Instance Method Details

#enter(language) ⇒ Object



97
98
99
100
101
102
103
# File 'lib/pjl.rb', line 97

def enter language
  pjl :enter, :language => language.to_sym
  yield
ensure
  uel
  pjl
end

#iparm(p) ⇒ Object



69
70
71
72
73
74
75
# File 'lib/pjl.rb', line 69

def iparm p
  m = @m
  @m = { :iparm => p.to_sym }
  yield
ensure
  @m = m
end

#job(name, *args) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/pjl.rb', line 48

def job name, *args
  print "\0"*32
  uel
  pjl
  j = { :name => name.to_s }
  args.push j
  pjl :job, *args
  yield
ensure
  pjl :eoj, j
  uel
end

#lparm(p) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/pjl.rb', line 61

def lparm p
  m = @m
  @m = { :lparm => p.to_sym }
  yield
ensure
  @m = m
end

#noopObject Also known as: nop



77
78
79
# File 'lib/pjl.rb', line 77

def noop
  pjl
end