pjl 1.2.2 → 1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64da9b59d4edfc301648f7da605cc066b0240dc8472737738924e0e1e514eb75
4
- data.tar.gz: 7c2e844b585114aabfb5e4145b29c8e2d3660f0eff54bbae805b4fdd44c99e09
3
+ metadata.gz: 72f1bb05a1399968b92593cde98e48cb1a8f6d5d5d9aa5ca6600bd0ffe7d5d5f
4
+ data.tar.gz: 33541860fca8f140777f0b0c9308d295927b77ae692e0af2c7e89056e43bc9e5
5
5
  SHA512:
6
- metadata.gz: 489963311a279752cb12df2478123a46fda84337b0c5f123e475fac985ed47b8bd142240cb0e4e3a450aff572d1ab5decff9a6fd5e84000ce94dbcb6af73604c
7
- data.tar.gz: 16a1023f936fb4bac4895e534667fae6c39e96f6503daa887d3fe31638dcfde76f15016bb17ebee9113bc93264e3bb8cc05a7d02f4094f0cfc75f4cc1ab99816
6
+ metadata.gz: 5fc3574f149d3cec9e8dae185e7ee302266341e2df007cf89ed14ca5540557646ff33bb3d083f552f5fe9406e55e918641a18e8ad31a1db9a66402c161a8f79a
7
+ data.tar.gz: '09eb6c97f5d0ad99476871c7373163151e1531cdbacbfaa5b6412ace4b4c6f1a051dd71b021959a4c296f08ade6098aa4c3c0e62212eba88fcb2d2e1e218e710'
@@ -22,14 +22,14 @@ class MFC7420Appl < PjlAppl
22
22
 
23
23
  def frame
24
24
  job "#@login@#@host-#$$" do
25
- set :ras1200mode => :off
26
- set :resolution => RES
27
- set :economode => :off
28
- set :sourcetray => :tray1
29
- set :mediatype => :regular
30
- set :orientation => :portrait
31
- set :paper => :a4
32
- set :pageprotect => :auto
25
+ set ras1200mode: :off
26
+ set resolution: RES
27
+ set economode: :off
28
+ set sourcetray: :tray1
29
+ set mediatype: :regular
30
+ set orientation: :portrait
31
+ set paper: :a4
32
+ set pageprotect: :auto
33
33
  enter :pcl do
34
34
  system *GS
35
35
  end
@@ -26,11 +26,10 @@ class CanonIRAppl < PjlAppl
26
26
  private
27
27
 
28
28
  def job
29
- uel
30
- pjl "CQue2.0-2"
31
- yield
32
- ensure
33
- uel
29
+ uels do
30
+ pjl "CQue2.0-2"
31
+ yield
32
+ end
34
33
  end
35
34
 
36
35
  GS = %w(
@@ -42,14 +41,14 @@ class CanonIRAppl < PjlAppl
42
41
  h, = Socket.gethostname.split "."
43
42
  jn = "#{h}-#$$!#@login@#@host"
44
43
  job do
45
- comment :canpjl, :set, :username => uh
46
- comment :canpjl, :set, :docname => jn
47
- comment :canpjl, :set, :sortermode => :genericon
48
- comment :canpjl, :set, :staple => :genericoff
49
- comment :canpjl, :set, :punch => :genericoff
50
- comment :canpjl, :set, :booklet => :genericoff
44
+ comment :canpjl, :set, username: uh
45
+ comment :canpjl, :set, docname: jn
46
+ comment :canpjl, :set, sortermode: :genericon
47
+ comment :canpjl, :set, staple: :genericoff
48
+ comment :canpjl, :set, punch: :genericoff
49
+ comment :canpjl, :set, booklet: :genericoff
51
50
  if @tray then
52
- set :mediasource => :"tray#@tray"
51
+ set mediasource: :"tray#@tray"
53
52
  end
54
53
  enter :pcl do
55
54
  system *GS
@@ -19,9 +19,9 @@ class KyoceraFSAppl < PjlAppl
19
19
  !R! FRPO N7,1; CMNT Postscripts settumble cannnot do that.; EXIT,E;
20
20
  EOT
21
21
  display = "#@login@#@host"
22
- job "#@login@#@host-#$$", :display => display do
23
- rdymsg :display => display
24
- set :economode => :off
22
+ job "#@login@#@host-#$$", display: display do
23
+ rdymsg display: display
24
+ set economode: :off
25
25
  enter :postscript do
26
26
  l = $stdin.readline
27
27
  case l
@@ -36,7 +36,7 @@ class KyoceraFSAppl < PjlAppl
36
36
  end
37
37
  end
38
38
  end
39
- rdymsg :display => ""
39
+ rdymsg display: ""
40
40
  end
41
41
  end
42
42
 
data/lib/pjl.rb CHANGED
@@ -33,7 +33,7 @@ end
33
33
  # include PJL
34
34
  # def run
35
35
  # job "job-#$$" do
36
- # rdymsg :display => "wait..."
36
+ # rdymsg display: "wait..."
37
37
  # enter :postscript do
38
38
  # puts "%!PS"
39
39
  # ...
@@ -45,22 +45,20 @@ end
45
45
  #
46
46
  module PJL
47
47
 
48
- def job name, *args
48
+ def job name, **kwargs
49
49
  print "\0"*32
50
- uel
51
- pjl
52
- j = { :name => name.to_s }
53
- args.push j
54
- pjl :job, *args
55
- yield
56
- ensure
57
- pjl :eoj, j
58
- uel
50
+ uels do
51
+ pjl
52
+ pjl :job, name: name, **kwargs
53
+ yield
54
+ ensure
55
+ pjl :eoj, name: name
56
+ end
59
57
  end
60
58
 
61
59
  def lparm p
62
60
  m = @m
63
- @m = { :lparm => p.to_sym }
61
+ @m = { lparm: p.to_sym }
64
62
  yield
65
63
  ensure
66
64
  @m = m
@@ -68,7 +66,7 @@ module PJL
68
66
 
69
67
  def iparm p
70
68
  m = @m
71
- @m = { :iparm => p.to_sym }
69
+ @m = { iparm: p.to_sym }
72
70
  yield
73
71
  ensure
74
72
  @m = m
@@ -79,23 +77,23 @@ module PJL
79
77
  end
80
78
  alias nop noop
81
79
 
82
- def method_missing name, *args, &block
80
+ def method_missing name, *args, **kwargs, &block
83
81
  if block then
84
82
  super
85
83
  else
86
84
  args.each { |a|
87
85
  case a
88
- when String, Symbol, Hash then next
89
- else super
86
+ when String, Symbol then next
87
+ else super
90
88
  end
91
89
  }
92
90
  if name.to_s =~ /\Apjl_/ then name = $'.to_sym end
93
- pjl name, *args
91
+ pjl name, *args, **kwargs
94
92
  end
95
93
  end
96
94
 
97
95
  def enter language
98
- pjl :enter, :language => language.to_sym
96
+ pjl :enter, language: language.to_sym
99
97
  yield
100
98
  ensure
101
99
  uel
@@ -108,23 +106,31 @@ module PJL
108
106
  print "\e%-12345X"
109
107
  end
110
108
 
111
- def pjl *args
112
- opt = {}
113
- opt.update args.pop while args.last.is_a? Hash
114
- l = []
109
+ def uels
110
+ uel
111
+ yield
112
+ ensure
113
+ uel
114
+ end
115
+
116
+ class Cmd
117
+ def initialize ; @cmd = "@PJL" ; end
118
+ def to_s ; @cmd ; end
119
+ def push k ; @cmd << " " << k.to_pjlkey ; end
120
+ def pushkw k, s, v ; push k ; @cmd << s << v.to_pjlkey ; end
121
+ end
122
+
123
+ def pjl *args, **kwargs
124
+ c = Cmd.new
115
125
  args.flatten!
116
- args.each { |a| l.push a }
117
- @m and @m.each { |k,v| l.push [ k, :":", v] }
118
- opt .each { |k,v| l.push [ k, :"=", v] }
119
- cmd = "@PJL"
120
- l.each { |x| cmd << " " << x.to_pjlkey }
121
- puts cmd
126
+ args .each { |a| c.push a }
127
+ @m &.each { |k,v| c.pushkw k, ":", v }
128
+ kwargs .each { |k,v| c.pushkw k, "=", v }
129
+ puts c
122
130
  end
123
131
 
124
132
  def system *args
125
- unless super then
126
- raise "#{args.first} terminated unsuccessful: #$?"
127
- end
133
+ super or raise "#{args.first} terminated unsuccessful: #$?"
128
134
  end
129
135
 
130
136
  end
@@ -5,7 +5,7 @@
5
5
  module PJL
6
6
 
7
7
  NAME = "pjl"
8
- VERSION = "1.2.2".freeze
8
+ VERSION = "1.3".freeze
9
9
 
10
10
  SUMMARY = "PJL generation"
11
11
 
@@ -13,7 +13,7 @@ module PJL
13
13
  Write PJL (Printer Job Language) commands from a Ruby program.
14
14
  EOT
15
15
 
16
- COPYRIGHT = "(C) 2013-2018 Bertram Scharpf"
16
+ COPYRIGHT = "(C) 2013-2020 Bertram Scharpf"
17
17
  LICENSE = "BSD-2-Clause"
18
18
  AUTHOR = "Bertram Scharpf <software@bertram-scharpf.de>"
19
19
  TEAM = [ "Bertram Scharpf"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pjl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-31 00:00:00.000000000 Z
11
+ date: 2020-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appl
@@ -49,7 +49,7 @@ homepage: http://www.bertram-scharpf.de/software/pjl
49
49
  licenses:
50
50
  - BSD-2-Clause
51
51
  metadata: {}
52
- post_install_message:
52
+ post_install_message:
53
53
  rdoc_options:
54
54
  - "--charset"
55
55
  - utf-8
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  requirements:
71
71
  - Some other tools from the same author
72
72
  rubygems_version: 3.0.6
73
- signing_key:
73
+ signing_key:
74
74
  specification_version: 4
75
75
  summary: PJL generation
76
76
  test_files: []