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 +4 -4
- data/Changelog.md +13 -0
- data/Gemfile.lock +1 -1
- data/README.md +11 -0
- data/lib/zpl-transformer/transformer/cmd_remover.rb +23 -0
- data/lib/zpl-transformer/transformers.rb +1 -0
- data/lib/zpl-transformer/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c374857ea41f937a78a1cb7e694f00a72480f24f
|
4
|
+
data.tar.gz: fc19bdec4ef355d1e979083fc7b0733e5b305c18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2390d41d3903ae20a0ade4104a8a6330988c655136f0a6b8f2a64b84ade36fe766d339901ef35a2a764c0060ec4ca7cebb40d898658b2fdff9b57c55a07bd493
|
7
|
+
data.tar.gz: 4b6fce1512268556ae97a9df56bdafc9d15df18891e424319d38dfda531f3820caead9a3491513938979d16f16264f4c54ad018d3fcf35e0391ea9c11330bc44
|
data/Changelog.md
ADDED
data/Gemfile.lock
CHANGED
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
|
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.
|
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-
|
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
|