zpl-transformer 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a171cfc23b0b63288839c6c0f6948ad12333b20a
4
- data.tar.gz: 38d6616c8eb3f461cee8991fde8ff3c38a43adb0
3
+ metadata.gz: c374857ea41f937a78a1cb7e694f00a72480f24f
4
+ data.tar.gz: fc19bdec4ef355d1e979083fc7b0733e5b305c18
5
5
  SHA512:
6
- metadata.gz: 3097288bb237fc643a27297ca9146c050a9aeaa2b65c45877452897d83a5d96192a8a594f5b72f772e3edf77fdc64ded4d06ba39d97e59893b92b280a7936d3a
7
- data.tar.gz: 60f0c3abfd8491b647327afba368b29f20c2a21fccfd1667933ae6be97ed0c3ada2ac812096cf4fc17c53e3c5d67b3e5e3b9b6eb879d030a98eed44ddab36cf6
6
+ metadata.gz: 2390d41d3903ae20a0ade4104a8a6330988c655136f0a6b8f2a64b84ade36fe766d339901ef35a2a764c0060ec4ca7cebb40d898658b2fdff9b57c55a07bd493
7
+ data.tar.gz: 4b6fce1512268556ae97a9df56bdafc9d15df18891e424319d38dfda531f3820caead9a3491513938979d16f16264f4c54ad018d3fcf35e0391ea9c11330bc44
data/Changelog.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0
4
+
5
+ - Feature: Add transformer to remove specific cmds by name
6
+
7
+ ## 0.2.0
8
+
9
+ - Add scaling for PW (Print Width) command
10
+
11
+ ## 0.1.0
12
+
13
+ Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zpl-transformer (0.2.0)
4
+ zpl-transformer (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -91,6 +91,17 @@ pipeline = Zpl::Transformer::Pipeline.new([
91
91
  pipeline.apply(code) # => "^XA^GB24,60,2,B^AA,18,10^XZ"
92
92
  ```
93
93
 
94
+ ### `Zpl::Transformer::CmdRemover`
95
+
96
+ This transformer will remove all commands given by name.
97
+
98
+ Example: This will remove the command named `MM`.
99
+ ```rb
100
+ code = '^LT0^LS0^MMT^XA^XZ'
101
+ remover = Zpl::Transformer::CmdRemover.new 'MM'
102
+ remover.apply(code) # => "^LT0^LS0^XA^XZ"
103
+ ```
104
+
94
105
 
95
106
  ## Installation
96
107
 
@@ -0,0 +1,23 @@
1
+ require_relative './base'
2
+
3
+ module Zpl
4
+ # This transformer will remove all commands given by name.
5
+ #
6
+ # Example: This will remove the command named `MM`.
7
+ # ```rb
8
+ # code = '^LT0^LS0^MMT^XA^XZ'
9
+ # remover = Zpl::Transformer::CmdRemover.new 'MM'
10
+ # remover.apply(code) # => "^LT0^LS0^XA^XZ"
11
+ # ```
12
+ class Transformer::CmdRemover < Transformer::Base
13
+
14
+ def initialize(*cmds_to_delete)
15
+ @cmds_to_delete = Set.new cmds_to_delete.flatten
16
+ end
17
+
18
+ def map_cmd cmd
19
+ cmd unless @cmds_to_delete.include?(cmd.name)
20
+ end
21
+
22
+ end
23
+ end
@@ -1,3 +1,4 @@
1
1
  require_relative './transformer/generic_scaler'
2
2
  require_relative './transformer/font_scaler'
3
3
  require_relative './transformer/pipeline'
4
+ require_relative './transformer/cmd_remover'
@@ -1,3 +1,3 @@
1
1
  module Zpl
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zpl-transformer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benoit de Chezelles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-29 00:00:00.000000000 Z
11
+ date: 2019-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -62,6 +62,7 @@ files:
62
62
  - ".circleci/config.yml"
63
63
  - ".gitignore"
64
64
  - ".rspec"
65
+ - Changelog.md
65
66
  - Gemfile
66
67
  - Gemfile.lock
67
68
  - LICENSE.txt
@@ -75,6 +76,7 @@ files:
75
76
  - lib/zpl-transformer/reader.rb
76
77
  - lib/zpl-transformer/transformer/base.rb
77
78
  - lib/zpl-transformer/transformer/base_scaler.rb
79
+ - lib/zpl-transformer/transformer/cmd_remover.rb
78
80
  - lib/zpl-transformer/transformer/font_scaler.rb
79
81
  - lib/zpl-transformer/transformer/generic_scaler.rb
80
82
  - lib/zpl-transformer/transformer/pipeline.rb