esc-pos 0.0.9 → 0.0.10
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 +4 -4
- data/lib/esc-pos/specifications/base.rb +10 -6
- data/lib/esc-pos/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 657ed746cc3d6a6edddd91f9c54484ae8fd1e11e
|
4
|
+
data.tar.gz: 36c4e2dc2f0ffa8f652ca0ff9c1b6a8966661c87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34ad07b0f36a54e1ea0397d184fd3b3a428d3bcd5cc46a941b88d61937e975c6d95529e3928ee592c8578a6076bfc258465bff9498cc4fac662f40190f5962ec
|
7
|
+
data.tar.gz: 6a92f3d13245a6c32d8ae87f702fd06b5382c433244a16878123d39fdf0222836ad463be4bd695f995eeeb791e9ab2345b2d9903dc6dd85500c165eaaf487be6
|
@@ -2,7 +2,6 @@ require 'erb'
|
|
2
2
|
|
3
3
|
module ESC_POS
|
4
4
|
module Specifications
|
5
|
-
|
6
5
|
class Base
|
7
6
|
|
8
7
|
def self.specifications
|
@@ -26,10 +25,8 @@ module ESC_POS
|
|
26
25
|
formatted_text << set_alignment(options[:align_type]) if options[:align_type]
|
27
26
|
formatted_text << set_color(color)
|
28
27
|
|
29
|
-
if txt
|
30
|
-
formatted_text << txt
|
31
|
-
elsif txt
|
32
|
-
formatted_text << txt
|
28
|
+
if txt
|
29
|
+
formatted_text << re_encode_text(txt)
|
33
30
|
end
|
34
31
|
|
35
32
|
formatted_text
|
@@ -97,7 +94,14 @@ module ESC_POS
|
|
97
94
|
self.class.specifications[key]
|
98
95
|
end
|
99
96
|
|
100
|
-
|
97
|
+
def re_encode_text(txt)
|
98
|
+
return txt unless get_value(:special_encoding)
|
101
99
|
|
100
|
+
txt.encode(get_value(:special_encoding))
|
101
|
+
rescue Encoding::UndefinedConversionError
|
102
|
+
txt
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
102
106
|
end
|
103
107
|
end
|
data/lib/esc-pos/version.rb
CHANGED