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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0fc9acc1747bc27c00e47c244c52e749c13f2b81
4
- data.tar.gz: 844cbf5dadb15a1ceddd487318586a8b756b90cc
3
+ metadata.gz: 657ed746cc3d6a6edddd91f9c54484ae8fd1e11e
4
+ data.tar.gz: 36c4e2dc2f0ffa8f652ca0ff9c1b6a8966661c87
5
5
  SHA512:
6
- metadata.gz: da3e881eff46296c5eaf87515d8e4728640000b23abf5ed45f09203a26345c717a68f6a31d9a45f71826f16920ac4e5dc6def4b691aee010fb89e79c437a3454
7
- data.tar.gz: 98ba9f8ba23b7849dfb2f32d9991cc8d84ca69e8f1938d46fcf8751795223426d35dd1c939a4560f3315d795d49117298a111baf74ceb0a2574da55bb4d38e43
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 && get_value(:special_encoding)
30
- formatted_text << txt.encode(get_value(:special_encoding))
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
- end
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
@@ -1,5 +1,5 @@
1
1
  module ESC_POS
2
2
 
3
- VERSION = '0.0.9'
3
+ VERSION = '0.0.10'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esc-pos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Gomez