barcodes 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +107 -0
- data/Rakefile +11 -0
- data/barcodes.gemspec +24 -0
- data/bin/barcodes +6 -0
- data/lib/barcodes.rb +63 -0
- data/lib/barcodes/exec.rb +74 -0
- data/lib/barcodes/renderer.rb +9 -0
- data/lib/barcodes/renderer/ascii.rb +199 -0
- data/lib/barcodes/renderer/pdf.rb +257 -0
- data/lib/barcodes/symbology.rb +47 -0
- data/lib/barcodes/symbology/base.rb +103 -0
- data/lib/barcodes/symbology/codabar.rb +36 -0
- data/lib/barcodes/symbology/code11.rb +74 -0
- data/lib/barcodes/symbology/code128.rb +317 -0
- data/lib/barcodes/symbology/code39.rb +48 -0
- data/lib/barcodes/symbology/code39extended.rb +93 -0
- data/lib/barcodes/symbology/code39extendedmod43.rb +73 -0
- data/lib/barcodes/symbology/code39mod43.rb +73 -0
- data/lib/barcodes/symbology/code93.rb +142 -0
- data/lib/barcodes/symbology/code93extended.rb +116 -0
- data/lib/barcodes/symbology/ean.rb +149 -0
- data/lib/barcodes/symbology/ean13.rb +27 -0
- data/lib/barcodes/symbology/ean8.rb +50 -0
- data/lib/barcodes/symbology/interleaved2of5.rb +30 -0
- data/lib/barcodes/symbology/interleaved2of5mod10.rb +40 -0
- data/lib/barcodes/symbology/msi.rb +30 -0
- data/lib/barcodes/symbology/msimod10.rb +50 -0
- data/lib/barcodes/symbology/msimod11.rb +37 -0
- data/lib/barcodes/symbology/planet.rb +83 -0
- data/lib/barcodes/symbology/postnet.rb +83 -0
- data/lib/barcodes/symbology/standard2of5.rb +30 -0
- data/lib/barcodes/symbology/standard2of5mod10.rb +40 -0
- data/lib/barcodes/symbology/upca.rb +27 -0
- data/lib/barcodes/version.rb +3 -0
- data/spec/barcodes/exec_spec.rb +14 -0
- data/spec/barcodes/renderer/ascii_spec.rb +12 -0
- data/spec/barcodes/renderer/pdf_spec.rb +12 -0
- data/spec/barcodes/symbology/base_spec.rb +8 -0
- data/spec/barcodes/symbology/codabar_spec.rb +8 -0
- data/spec/barcodes/symbology/code11_spec.rb +8 -0
- data/spec/barcodes/symbology/code128_spec.rb +8 -0
- data/spec/barcodes/symbology/code39_spec.rb +8 -0
- data/spec/barcodes/symbology/code39extended_spec.rb +8 -0
- data/spec/barcodes/symbology/code39extendedmod43_spec.rb +8 -0
- data/spec/barcodes/symbology/code39mod43_spec.rb +8 -0
- data/spec/barcodes/symbology/code93_spec.rb +8 -0
- data/spec/barcodes/symbology/code93extended_spec.rb +8 -0
- data/spec/barcodes/symbology/ean13_spec.rb +8 -0
- data/spec/barcodes/symbology/ean8_spec.rb +8 -0
- data/spec/barcodes/symbology/ean_spec.rb +8 -0
- data/spec/barcodes/symbology/interleaved2of5_spec.rb +8 -0
- data/spec/barcodes/symbology/interleaved2of5mod10_spec.rb +8 -0
- data/spec/barcodes/symbology/msi_spec.rb +8 -0
- data/spec/barcodes/symbology/msimod10_spec.rb +8 -0
- data/spec/barcodes/symbology/msimod11_spec.rb +8 -0
- data/spec/barcodes/symbology/planet_spec.rb +8 -0
- data/spec/barcodes/symbology/postnet_spec.rb +8 -0
- data/spec/barcodes/symbology/standard2of5_spec.rb +8 -0
- data/spec/barcodes/symbology/standard2of5mod10_spec.rb +8 -0
- data/spec/barcodes/symbology/upca_spec.rb +8 -0
- data/spec/barcodes_spec.rb +27 -0
- data/spec/spec_helper.rb +17 -0
- metadata +174 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'barcodes/symbology/code39extended'
|
2
|
+
|
3
|
+
module Barcodes
|
4
|
+
module Symbology
|
5
|
+
class Code39ExtendedMod43 < Code39Extended
|
6
|
+
def caption_data
|
7
|
+
@start_character + @data + @stop_character
|
8
|
+
end
|
9
|
+
|
10
|
+
def formatted_data
|
11
|
+
checksum = self.checksum
|
12
|
+
unless checksum.nil?
|
13
|
+
@start_character + @data + checksum + @stop_character
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def checksum
|
18
|
+
if valid?
|
19
|
+
sum = 0
|
20
|
+
self.data.each_char do |char|
|
21
|
+
if ('0'..'9').include? char
|
22
|
+
sum += char.to_i
|
23
|
+
elsif ('A'..'Z').include? char
|
24
|
+
sum += ('A'..'Z').to_a.index(char) + 10
|
25
|
+
else
|
26
|
+
case char
|
27
|
+
when '-'
|
28
|
+
sum += 36
|
29
|
+
when '.'
|
30
|
+
sum += 37
|
31
|
+
when ' '
|
32
|
+
sum += 38
|
33
|
+
when '$'
|
34
|
+
sum += 39
|
35
|
+
when '/'
|
36
|
+
sum += 40
|
37
|
+
when '+'
|
38
|
+
sum += 41
|
39
|
+
when '%'
|
40
|
+
sum += 42
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
value = sum % 43
|
46
|
+
|
47
|
+
if (0..9).include? value
|
48
|
+
return value.to_s
|
49
|
+
elsif value >= 10 && value < 36
|
50
|
+
return ('A'..'Z').to_a.fetch(value - 10)
|
51
|
+
else
|
52
|
+
case value
|
53
|
+
when 36
|
54
|
+
return '-'
|
55
|
+
when 37
|
56
|
+
return '.'
|
57
|
+
when 38
|
58
|
+
return ' '
|
59
|
+
when 39
|
60
|
+
return '$'
|
61
|
+
when 40
|
62
|
+
return '/'
|
63
|
+
when 41
|
64
|
+
return '+'
|
65
|
+
when 42
|
66
|
+
return '%'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'barcodes/symbology/code39'
|
2
|
+
|
3
|
+
module Barcodes
|
4
|
+
module Symbology
|
5
|
+
class Code39Mod43 < Code39
|
6
|
+
def caption_data
|
7
|
+
@start_character + @data + @stop_character
|
8
|
+
end
|
9
|
+
|
10
|
+
def formatted_data
|
11
|
+
checksum = self.checksum
|
12
|
+
unless checksum.nil?
|
13
|
+
@start_character + @data + checksum + @stop_character
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def checksum
|
18
|
+
if self.valid?
|
19
|
+
sum = 0
|
20
|
+
self.data.each_char do |char|
|
21
|
+
if ('0'..'9').include? char
|
22
|
+
sum += char.to_i
|
23
|
+
elsif ('A'..'Z').include? char
|
24
|
+
sum += ('A'..'Z').to_a.index(char) + 10
|
25
|
+
else
|
26
|
+
case char
|
27
|
+
when '-'
|
28
|
+
sum += 36
|
29
|
+
when '.'
|
30
|
+
sum += 37
|
31
|
+
when ' '
|
32
|
+
sum += 38
|
33
|
+
when '$'
|
34
|
+
sum += 39
|
35
|
+
when '/'
|
36
|
+
sum += 40
|
37
|
+
when '+'
|
38
|
+
sum += 41
|
39
|
+
when '%'
|
40
|
+
sum += 42
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
value = sum % 43
|
46
|
+
|
47
|
+
if (0..9).include? value
|
48
|
+
return value.to_s
|
49
|
+
elsif value >= 10 && value < 36
|
50
|
+
return ('A'..'Z').to_a.fetch(value - 10)
|
51
|
+
else
|
52
|
+
case value
|
53
|
+
when 36
|
54
|
+
return '-'
|
55
|
+
when 37
|
56
|
+
return '.'
|
57
|
+
when 38
|
58
|
+
return ' '
|
59
|
+
when 39
|
60
|
+
return '$'
|
61
|
+
when 40
|
62
|
+
return '/'
|
63
|
+
when 41
|
64
|
+
return '+'
|
65
|
+
when 42
|
66
|
+
return '%'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
require 'barcodes/symbology/base'
|
2
|
+
|
3
|
+
module Barcodes
|
4
|
+
module Symbology
|
5
|
+
class Code93 < Base
|
6
|
+
def self.charset
|
7
|
+
[
|
8
|
+
"0","1","2","3","4","5","6","7","8","9",
|
9
|
+
"A","B","C","D","E","F","G","H","I","J",
|
10
|
+
"K","L","M","N","O","P","Q","R","S","T",
|
11
|
+
"U","V","W","X","Y","Z","-","."," ","$",
|
12
|
+
"/","+","%","*","\xFC","\xFD","\xFE","\xFF"
|
13
|
+
].collect {|c| c.bytes.to_a[0] }
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.valueset
|
17
|
+
[
|
18
|
+
"100010100","101001000","101000100","101000010",
|
19
|
+
"100101000","100100100","100100010","101010000",
|
20
|
+
"100010010","100001010","110101000","110100100",
|
21
|
+
"110100010","110010100","110010010","110001010",
|
22
|
+
"101101000","101100100","101100010","100110100",
|
23
|
+
"100011010","101011000","101001100","101000110",
|
24
|
+
"100101100","100010110","110110100","110110010",
|
25
|
+
"110101100","110100110","110010110","110011010",
|
26
|
+
"101101100","101100110","100110110","100111010",
|
27
|
+
"100101110","111010100","111010010","111001010",
|
28
|
+
"101101110","101110110","110101110","101011110",
|
29
|
+
"100100110","111011010","111010110","100110010"
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def initialize(args={})
|
34
|
+
super(args)
|
35
|
+
|
36
|
+
@start_character = '*'
|
37
|
+
@stop_character = '*'
|
38
|
+
end
|
39
|
+
|
40
|
+
def caption_data
|
41
|
+
@start_character + @data + @stop_character
|
42
|
+
end
|
43
|
+
|
44
|
+
def formatted_data
|
45
|
+
checksum = self.checksum
|
46
|
+
unless checksum.nil?
|
47
|
+
@start_character + @data + checksum + @stop_character
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def checksum
|
52
|
+
if self.valid?
|
53
|
+
c_value = self._checksum(@data, 20)
|
54
|
+
k_value = self._checksum(@data + c_value, 15)
|
55
|
+
return c_value + k_value
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
protected
|
60
|
+
|
61
|
+
def _checksum(data, weight_max)
|
62
|
+
sum = 0
|
63
|
+
weight = 1
|
64
|
+
data.reverse.each_byte do |char|
|
65
|
+
if char == 255 || char == 254 || char == 253 || char == 252
|
66
|
+
case char
|
67
|
+
when 252
|
68
|
+
sum += 43
|
69
|
+
when 253
|
70
|
+
sum += 44
|
71
|
+
when 254
|
72
|
+
sum += 45
|
73
|
+
when 255
|
74
|
+
sum += 46
|
75
|
+
end
|
76
|
+
else
|
77
|
+
if ('0'..'9').include? char.chr
|
78
|
+
sum += weight * char.chr.to_i
|
79
|
+
elsif ('A'..'Z').include? char.chr
|
80
|
+
sum += ('A'..'Z').to_a.index(char.chr) + 10
|
81
|
+
else
|
82
|
+
case char.chr
|
83
|
+
when '-'
|
84
|
+
sum += 36
|
85
|
+
when '.'
|
86
|
+
sum += 37
|
87
|
+
when ' '
|
88
|
+
sum += 38
|
89
|
+
when '$'
|
90
|
+
sum += 39
|
91
|
+
when '/'
|
92
|
+
sum += 40
|
93
|
+
when '+'
|
94
|
+
sum += 41
|
95
|
+
when '%'
|
96
|
+
sum += 42
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
if weight <= weight_max
|
101
|
+
weight += 1
|
102
|
+
else
|
103
|
+
weight = 1
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
value = sum % 47
|
108
|
+
|
109
|
+
if (0..9).include? value
|
110
|
+
return value.to_s
|
111
|
+
elsif value >= 10 && value < 36
|
112
|
+
return ('A'..'Z').to_a.fetch(value - 10)
|
113
|
+
else
|
114
|
+
case value
|
115
|
+
when 36
|
116
|
+
return '-'
|
117
|
+
when 37
|
118
|
+
return '.'
|
119
|
+
when 38
|
120
|
+
return ' '
|
121
|
+
when 39
|
122
|
+
return '$'
|
123
|
+
when 40
|
124
|
+
return '/'
|
125
|
+
when 41
|
126
|
+
return '+'
|
127
|
+
when 42
|
128
|
+
return '%'
|
129
|
+
when 43
|
130
|
+
return "\xFC"
|
131
|
+
when 44
|
132
|
+
return "\xFD"
|
133
|
+
when 45
|
134
|
+
return "\xFE"
|
135
|
+
when 46
|
136
|
+
return "\xFF"
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'barcodes/symbology/code93'
|
2
|
+
|
3
|
+
module Barcodes
|
4
|
+
module Symbology
|
5
|
+
class Code93Extended < Code93
|
6
|
+
|
7
|
+
def formatted_data
|
8
|
+
checksum = self.checksum
|
9
|
+
unless checksum.nil?
|
10
|
+
@start_character + self._data + checksum + @stop_character
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def checksum
|
15
|
+
if self.valid?
|
16
|
+
data = self._data
|
17
|
+
c_value = self._checksum(data, 20)
|
18
|
+
k_value = self._checksum(data + c_value, 15)
|
19
|
+
return c_value + k_value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def valid?
|
24
|
+
return !self._data.nil?
|
25
|
+
end
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
def _data
|
30
|
+
_data = ''
|
31
|
+
self.data.each_byte do |char|
|
32
|
+
unless self._encode_character(char).nil?
|
33
|
+
_data += char.chr
|
34
|
+
else
|
35
|
+
case char
|
36
|
+
when 0
|
37
|
+
_data += "\xFD" + "U"
|
38
|
+
when 1..26
|
39
|
+
_data += "\xFC" + (char + 64).chr
|
40
|
+
when 27..31
|
41
|
+
_data += "\xFD" + (char + 38).chr
|
42
|
+
when 127
|
43
|
+
_data += "\xFD" + "T"
|
44
|
+
when '!'.bytes.to_a[0]
|
45
|
+
_data += "\xFE" + "A"
|
46
|
+
when '"'.bytes.to_a[0]
|
47
|
+
_data += "\xFE" + "B"
|
48
|
+
when '#'.bytes.to_a[0]
|
49
|
+
_data += "\xFE" + "C"
|
50
|
+
when '$'.bytes.to_a[0]
|
51
|
+
_data += "\xFE" + "D"
|
52
|
+
when '%'.bytes.to_a[0]
|
53
|
+
_data += "\xFE" + "E"
|
54
|
+
when '&'.bytes.to_a[0]
|
55
|
+
_data += "\xFE" + "F"
|
56
|
+
when '\''.bytes.to_a[0]
|
57
|
+
_data += "\xFE" + "G"
|
58
|
+
when '('.bytes.to_a[0]
|
59
|
+
_data += "\xFE" + "H"
|
60
|
+
when ')'.bytes.to_a[0]
|
61
|
+
_data += "\xFE" + "I"
|
62
|
+
when '*'.bytes.to_a[0]
|
63
|
+
_data += "\xFE" + "J"
|
64
|
+
when '+'.bytes.to_a[0]
|
65
|
+
_data += "\xFE" + "K"
|
66
|
+
when ','.bytes.to_a[0]
|
67
|
+
_data += "\xFE" + "L"
|
68
|
+
when '/'.bytes.to_a[0]
|
69
|
+
_data += "\xFE" + "O"
|
70
|
+
when ':'.bytes.to_a[0]
|
71
|
+
_data += "\xFE" + "Z"
|
72
|
+
when ';'.bytes.to_a[0]
|
73
|
+
_data += "\xFD" + "F"
|
74
|
+
when '<'.bytes.to_a[0]
|
75
|
+
_data += "\xFD" + "G"
|
76
|
+
when '='.bytes.to_a[0]
|
77
|
+
_data += "\xFD" + "H"
|
78
|
+
when '>'.bytes.to_a[0]
|
79
|
+
_data += "\xFD" + "I"
|
80
|
+
when '?'.bytes.to_a[0]
|
81
|
+
_data += "\xFD" + "J"
|
82
|
+
when '@'.bytes.to_a[0]
|
83
|
+
_data += "\xFD" + "V"
|
84
|
+
when '['.bytes.to_a[0]
|
85
|
+
_data += "\xFD" + "K"
|
86
|
+
when '\\'.bytes.to_a[0]
|
87
|
+
_data += "\xFD" + "L"
|
88
|
+
when ']'.bytes.to_a[0]
|
89
|
+
_data += "\xFD" + "M"
|
90
|
+
when '^'.bytes.to_a[0]
|
91
|
+
_data += "\xFD" + "N"
|
92
|
+
when '_'.bytes.to_a[0]
|
93
|
+
_data += "\xFD" + "0"
|
94
|
+
when '`'.bytes.to_a[0]
|
95
|
+
_data += "\xFD" + "W"
|
96
|
+
when 97..122
|
97
|
+
_data += "\xFF" + char.chr.upcase
|
98
|
+
when '{'.bytes.to_a[0]
|
99
|
+
_data += "\xFD" + "P"
|
100
|
+
when '|'.bytes.to_a[0]
|
101
|
+
_data += "\xFD" + "Q"
|
102
|
+
when '}'.bytes.to_a[0]
|
103
|
+
_data += "\xFD" + "R"
|
104
|
+
when '~'.bytes.to_a[0]
|
105
|
+
_data += "\xFD" + "S"
|
106
|
+
else
|
107
|
+
return nil
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
return _data
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
require 'barcodes/symbology/base'
|
2
|
+
|
3
|
+
module Barcodes
|
4
|
+
module Symbology
|
5
|
+
class Ean < Base
|
6
|
+
def self.charset
|
7
|
+
['0','1','2','3','4','5','6','7','8','9','S','C'].collect {|c| c.bytes.to_a[0] }
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.parity
|
11
|
+
[
|
12
|
+
"000000", "001011", "001101", "001110",
|
13
|
+
"010011", "011001", "011100", "010101",
|
14
|
+
"010110", "011010"
|
15
|
+
]
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.left_hand_even
|
19
|
+
[
|
20
|
+
"0001101", "0011001", "0010011", "0111101",
|
21
|
+
"0100011", "0110001", "0101111", "0111011",
|
22
|
+
"0110111", "0001011"
|
23
|
+
]
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.left_hand_odd
|
27
|
+
[
|
28
|
+
"0100111", "0110011", "0011011", "0100001",
|
29
|
+
"0011101", "0111001", "0000101", "0010001",
|
30
|
+
"0001001", "0010111"
|
31
|
+
]
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.right_hand
|
35
|
+
[
|
36
|
+
"1110010", "1100110", "1101100", "1000010",
|
37
|
+
"1011100", "1001110", "1010000", "1000100",
|
38
|
+
"1001000", "1110100"
|
39
|
+
]
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.valueset
|
43
|
+
[]
|
44
|
+
end
|
45
|
+
|
46
|
+
def initialize(args={})
|
47
|
+
super(args)
|
48
|
+
|
49
|
+
@start_character = 'S'
|
50
|
+
@stop_character = 'S'
|
51
|
+
@center_character = 'C'
|
52
|
+
end
|
53
|
+
|
54
|
+
def caption_data
|
55
|
+
@data + self.checksum
|
56
|
+
end
|
57
|
+
|
58
|
+
def encoded_data
|
59
|
+
if self.valid?
|
60
|
+
formatted_data = self.formatted_data
|
61
|
+
encoded_data = ""
|
62
|
+
parity = nil
|
63
|
+
index = 0
|
64
|
+
formatted_data.each_byte do |char|
|
65
|
+
if char.chr == 'S'
|
66
|
+
encoded_data += "101"
|
67
|
+
elsif char.chr == 'C'
|
68
|
+
encoded_data += "01010"
|
69
|
+
else
|
70
|
+
if index < 9
|
71
|
+
unless parity.nil?
|
72
|
+
encoded_data += self._encode_character_with_parity(char, parity[index - 2])
|
73
|
+
else
|
74
|
+
parity = self.class.parity.at(self.class.charset.index(char))
|
75
|
+
end
|
76
|
+
else
|
77
|
+
encoded_data += self._encode_character_with_right_hand(char)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
index += 1
|
81
|
+
end
|
82
|
+
encoded_data
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def quiet_zone_width
|
87
|
+
self.bar_width * 9
|
88
|
+
end
|
89
|
+
|
90
|
+
def checksum
|
91
|
+
if self.valid?
|
92
|
+
sum = 0
|
93
|
+
index = 1
|
94
|
+
@data.reverse.each_char do |char|
|
95
|
+
if ('0'..'9').include? char
|
96
|
+
if index.even?
|
97
|
+
sum += char.to_i
|
98
|
+
else
|
99
|
+
sum += char.to_i * 3
|
100
|
+
end
|
101
|
+
end
|
102
|
+
index += 1
|
103
|
+
end
|
104
|
+
|
105
|
+
value = 10 - (sum % 10)
|
106
|
+
|
107
|
+
return value.to_s
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def valid?
|
112
|
+
self.data.each_byte do |char|
|
113
|
+
if char.chr == 'S' || char.chr == 'C'
|
114
|
+
return false
|
115
|
+
end
|
116
|
+
unless self.class.charset.include? char
|
117
|
+
return false
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
protected
|
123
|
+
|
124
|
+
def _encode_character_with_parity(character, parity)
|
125
|
+
if self.class.charset.include? character
|
126
|
+
if parity.to_i.even?
|
127
|
+
self.class.left_hand_even.at(self.class.charset.index(character))
|
128
|
+
else
|
129
|
+
self.class.left_hand_odd.at(self.class.charset.index(character))
|
130
|
+
end
|
131
|
+
else
|
132
|
+
return nil
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def _encode_character_with_right_hand(character)
|
137
|
+
if self.class.charset.include? character
|
138
|
+
self.class.right_hand.at(self.class.charset.index(character))
|
139
|
+
else
|
140
|
+
return nil
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def _encode_character(character)
|
145
|
+
nil
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|