basehangul 1.0.0 → 1.1.0
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/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +8 -3
- data/CHANGELOG.md +5 -0
- data/README.md +4 -3
- data/basehangul.gemspec +2 -2
- data/lib/basehangul/utils.rb +44 -5
- data/lib/basehangul/version.rb +1 -1
- data/lib/basehangul.rb +40 -4
- data/spec/basehangul/utils_spec.rb +8 -5
- data/spec/basehangul_spec.rb +112 -28
- data/spec/support/shared_decode.rb +65 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dea832635fe4ba4c9cb0e698175e776ebc273ce
|
4
|
+
data.tar.gz: af201548ca14b381e7cad53b6674acb988b87c79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e02f9167a48cb7a28c3328a2a216d5b2f6ca084312c9c3df2aff4f505137139348e3295dcc857962cd9fbb62a1aab3c77e1c8b0ea3f86254bd1894b67091cd4
|
7
|
+
data.tar.gz: f09e00ca1d6d6745ca3ad7e511d25de23174906243e1117739feac6def022317293ebdc1449f288811cf1f85d32fad12889faa9ab6dda2ac254b0f164b1d2056
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
-
# on 2014-11-
|
2
|
+
# on 2014-11-08 01:14:38 +0900 using RuboCop version 0.27.0.
|
3
3
|
# The point is for the user to remove these configuration records
|
4
4
|
# one by one as the offenses are removed from the code base.
|
5
5
|
# Note that changes in the inspected code, or installation of new
|
6
6
|
# versions of RuboCop, may require this file to be generated again.
|
7
7
|
|
8
|
-
# Offense count:
|
8
|
+
# Offense count: 3
|
9
9
|
Metrics/AbcSize:
|
10
|
-
Max:
|
10
|
+
Max: 21
|
11
|
+
|
12
|
+
# Offense count: 1
|
13
|
+
# Configuration parameters: CountComments.
|
14
|
+
Metrics/MethodLength:
|
15
|
+
Max: 15
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# BaseHangul
|
2
2
|
|
3
|
+
[](http://badge.fury.io/rb/basehangul)
|
3
4
|
[](https://travis-ci.org/yous/basehangul)
|
4
5
|
[](https://gemnasium.com/yous/basehangul)
|
5
6
|
[](https://codeclimate.com/github/yous/basehangul)
|
6
7
|
[](https://coveralls.io/r/yous/basehangul)
|
7
8
|
[](http://inch-ci.org/github/yous/basehangul)
|
8
9
|
|
9
|
-
[BaseHangul](https://github.
|
10
|
+
Human-readable binary encoding, [BaseHangul](https://basehangul.github.io) for Ruby.
|
10
11
|
|
11
12
|
## Installation
|
12
13
|
|
@@ -32,10 +33,10 @@ gem install basehangul
|
|
32
33
|
|
33
34
|
``` ruby
|
34
35
|
BaseHangul.encode('This is an encoded string')
|
35
|
-
# =>
|
36
|
+
# => '넥라똔먈늴멥갯놓궂뗐밸뮤뉴뗐뀄굡덜멂똑뚤'
|
36
37
|
|
37
38
|
BaseHangul.decode('넥라똔먈늴멥갯놓궂뗐밸뮤뉴뗐뀄굡덜멂똑뚤')
|
38
|
-
# =>
|
39
|
+
# => 'This is an encoded string'
|
39
40
|
```
|
40
41
|
|
41
42
|
## Contributing
|
data/basehangul.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.version = BaseHangul::Version::STRING
|
10
10
|
spec.authors = ['ChaYoung You']
|
11
11
|
spec.email = %w(yousbe@gmail.com)
|
12
|
-
spec.summary = 'BaseHangul for Ruby.'
|
13
|
-
spec.description = 'BaseHangul for Ruby.'
|
12
|
+
spec.summary = 'Human-readable binary encoding, BaseHangul for Ruby.'
|
13
|
+
spec.description = 'Human-readable binary encoding, BaseHangul for Ruby.'
|
14
14
|
spec.homepage = ''
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
data/lib/basehangul/utils.rb
CHANGED
@@ -7,22 +7,47 @@ module BaseHangul
|
|
7
7
|
#
|
8
8
|
# hangul - A hangul character encoded with BaseHangul.
|
9
9
|
#
|
10
|
-
#
|
11
|
-
#
|
10
|
+
# Examples
|
11
|
+
#
|
12
|
+
# to_index('가')
|
13
|
+
# # => 0
|
14
|
+
#
|
15
|
+
# to_index('빌')
|
16
|
+
# # => 1023
|
17
|
+
#
|
18
|
+
# to_index('빗')
|
19
|
+
# # => 1027
|
20
|
+
#
|
21
|
+
# to_index('흐')
|
22
|
+
# # => -1
|
23
|
+
#
|
24
|
+
# Returns the Integer index of the hangul between 0 to 1027 or nil if the
|
25
|
+
# character is invalid for BaseHangul.
|
12
26
|
def self.to_index(hangul)
|
13
27
|
return -1 if hangul == PADDING
|
14
28
|
offset = hangul.encode(Encoding::EUC_KR).ord - 0xB0A1
|
15
29
|
index = offset / 0x100 * 0x5E + offset % 0x100
|
16
|
-
if index < 0 || index > 1027
|
17
|
-
fail ArgumentError, 'Not a valid BaseHangul string'
|
18
|
-
end
|
30
|
+
return nil if index < 0 || index > 1027
|
19
31
|
index
|
32
|
+
rescue Encoding::UndefinedConversionError
|
33
|
+
nil
|
20
34
|
end
|
21
35
|
|
22
36
|
# Convert a index to hangul character.
|
23
37
|
#
|
24
38
|
# index - An Integer to convert.
|
25
39
|
#
|
40
|
+
# Examples
|
41
|
+
#
|
42
|
+
# to_hangul(0)
|
43
|
+
# # => '가'
|
44
|
+
#
|
45
|
+
# to_hangul(1023)
|
46
|
+
# # => '빌'
|
47
|
+
#
|
48
|
+
# to_hangul(1027)
|
49
|
+
# # => '빗'
|
50
|
+
#
|
26
51
|
# Returns the String hangul for given index.
|
27
52
|
# Raises IndexError if the index is out of range 0..1027.
|
28
53
|
def self.to_hangul(index)
|
@@ -38,6 +63,20 @@ module BaseHangul
|
|
38
63
|
# str - The String to slice.
|
39
64
|
# size - The Integer max size of each chunk.
|
40
65
|
#
|
66
|
+
# Examples
|
67
|
+
#
|
68
|
+
# chunks('foo', 1)
|
69
|
+
# # => ['f', 'o', 'o']
|
70
|
+
#
|
71
|
+
# chunks('foobarbaz', 3)
|
72
|
+
# # => ['foo', 'bar', 'baz']
|
73
|
+
#
|
74
|
+
# chunks('abcd1234AB', 4)
|
75
|
+
# # => ['abcd', '1234', 'AB']
|
76
|
+
#
|
77
|
+
# chunks('', 1)
|
78
|
+
# # => []
|
79
|
+
#
|
41
80
|
# Returns an Array of chunked Strings.
|
42
81
|
# Raises ArgumentError if the size is smaller then or equal to 0.
|
43
82
|
def self.chunks(str, size)
|
data/lib/basehangul/version.rb
CHANGED
data/lib/basehangul.rb
CHANGED
@@ -3,11 +3,23 @@
|
|
3
3
|
require 'basehangul/version'
|
4
4
|
require 'basehangul/utils'
|
5
5
|
|
6
|
-
#
|
6
|
+
# Human-readable binary encoding.
|
7
7
|
module BaseHangul
|
8
8
|
# Character for padding on encoding.
|
9
9
|
PADDING = '흐'.freeze
|
10
|
-
|
10
|
+
|
11
|
+
# Error message for invalid character.
|
12
|
+
MSG_INVALID_CHAR = 'Invalid character found'
|
13
|
+
|
14
|
+
# Error message for incorrect padding.
|
15
|
+
MSG_INVALID_PADDING = 'Invalid padding'
|
16
|
+
|
17
|
+
# Regular expression for BaseHangul.
|
18
|
+
REGEX_BASEHANGUL = Regexp.new('^(?:[^빎빔빕빗흐]{4})*' \
|
19
|
+
'(?:[^빎빔빕빗흐]흐{3}|[^빎빔빕빗흐]{2}흐{2}|' \
|
20
|
+
'[^빎빔빕빗흐]{3}[빎빔빕빗흐])?$').freeze
|
21
|
+
|
22
|
+
private_constant :PADDING, :MSG_INVALID_CHAR, :MSG_INVALID_PADDING
|
11
23
|
|
12
24
|
# Public: Encode binary with BaseHangul.
|
13
25
|
#
|
@@ -27,7 +39,8 @@ module BaseHangul
|
|
27
39
|
chunks.map { |b| Utils.to_hangul(b.ljust(10, '0').to_i(2)) }.join + padding
|
28
40
|
end
|
29
41
|
|
30
|
-
# Public: Decode BaseHangul string.
|
42
|
+
# Public: Decode BaseHangul string. Characters outside the BaseHangul are
|
43
|
+
# ignored.
|
31
44
|
#
|
32
45
|
# str - A String encoded with BaseHangul.
|
33
46
|
#
|
@@ -36,7 +49,30 @@ module BaseHangul
|
|
36
49
|
indices = str.each_char.map { |ch| Utils.to_index(ch) }
|
37
50
|
binary = indices.map do |index|
|
38
51
|
case index
|
39
|
-
when
|
52
|
+
when 0..1023 then index.to_s(2).rjust(10, '0')
|
53
|
+
when 1024..1027 then (index - 1024).to_s(2).rjust(2, '0')
|
54
|
+
end
|
55
|
+
end.join
|
56
|
+
binary = binary[0..-(binary.size % 8 + 1)]
|
57
|
+
[binary].pack('B*')
|
58
|
+
end
|
59
|
+
|
60
|
+
# Public: Decode BaseHangul string.
|
61
|
+
#
|
62
|
+
# str - A String encoded with BaseHangul.
|
63
|
+
#
|
64
|
+
# Returns the String decoded binary.
|
65
|
+
# Raises ArgumentError if str is invalid BaseHangul.
|
66
|
+
def self.strict_decode(str)
|
67
|
+
indices = []
|
68
|
+
str.each_char do |ch|
|
69
|
+
index = Utils.to_index(ch)
|
70
|
+
fail ArgumentError, MSG_INVALID_CHAR if index.nil?
|
71
|
+
indices << index
|
72
|
+
end
|
73
|
+
fail ArgumentError, MSG_INVALID_PADDING unless str =~ REGEX_BASEHANGUL
|
74
|
+
binary = indices.map do |index|
|
75
|
+
case index
|
40
76
|
when 0..1023 then index.to_s(2).rjust(10, '0')
|
41
77
|
when 1024..1027 then (index - 1024).to_s(2).rjust(2, '0')
|
42
78
|
end
|
@@ -19,12 +19,15 @@ RSpec.describe BaseHangul::Utils do
|
|
19
19
|
expect(index).to eq(-1)
|
20
20
|
end
|
21
21
|
|
22
|
-
it '
|
23
|
-
range =
|
24
|
-
|
22
|
+
it 'returns nil for invalid character' do
|
23
|
+
range = ["\x00", "\uFFFF",
|
24
|
+
'A', 'b', '1',
|
25
|
+
'갂', '갃', '뷁',
|
26
|
+
*('빙'.encode(Encoding::EUC_KR)..'힝'.encode(Encoding::EUC_KR))
|
27
|
+
.map { |v| v.encode(Encoding::UTF_8) }]
|
25
28
|
range.reject { |v| v == padding }.each do |hangul|
|
26
|
-
|
27
|
-
|
29
|
+
index = utils.to_index(hangul)
|
30
|
+
expect(index).to eq(nil)
|
28
31
|
end
|
29
32
|
end
|
30
33
|
end
|
data/spec/basehangul_spec.rb
CHANGED
@@ -17,6 +17,10 @@ RSpec.describe BaseHangul do
|
|
17
17
|
expect(encoded).to eq('꺽먹꼍녜')
|
18
18
|
encoded = basehangul.encode("123d\x00")
|
19
19
|
expect(encoded).to eq('꺽먹꼐가')
|
20
|
+
encoded = basehangul.encode('1234567890')
|
21
|
+
expect(encoded).to eq('꺽먹께겔꼍뮷뒝낮')
|
22
|
+
encoded = basehangul.encode("12345678d\x00")
|
23
|
+
expect(encoded).to eq('꺽먹께겔꼍뮷듕가')
|
20
24
|
end
|
21
25
|
end
|
22
26
|
|
@@ -28,6 +32,12 @@ RSpec.describe BaseHangul do
|
|
28
32
|
expect(encoded).to eq('꺽먈흐흐')
|
29
33
|
encoded = basehangul.encode('123')
|
30
34
|
expect(encoded).to eq('꺽먹꺄흐')
|
35
|
+
encoded = basehangul.encode('123456')
|
36
|
+
expect(encoded).to eq('꺽먹께겔꼍흐흐흐')
|
37
|
+
encoded = basehangul.encode('1234567')
|
38
|
+
expect(encoded).to eq('꺽먹께겔꼍뮨흐흐')
|
39
|
+
encoded = basehangul.encode('12345678')
|
40
|
+
expect(encoded).to eq('꺽먹께겔꼍뮷됩흐')
|
31
41
|
end
|
32
42
|
end
|
33
43
|
|
@@ -41,48 +51,122 @@ RSpec.describe BaseHangul do
|
|
41
51
|
expect(encoded).to eq('꺽먹꼐빕')
|
42
52
|
encoded = basehangul.encode('123g')
|
43
53
|
expect(encoded).to eq('꺽먹꼐빗')
|
54
|
+
encoded = basehangul.encode('12345678d')
|
55
|
+
expect(encoded).to eq('꺽먹께겔꼍뮷듕빎')
|
56
|
+
encoded = basehangul.encode('12345678e')
|
57
|
+
expect(encoded).to eq('꺽먹께겔꼍뮷듕빔')
|
58
|
+
encoded = basehangul.encode('12345678f')
|
59
|
+
expect(encoded).to eq('꺽먹께겔꼍뮷듕빕')
|
60
|
+
encoded = basehangul.encode('12345678g')
|
61
|
+
expect(encoded).to eq('꺽먹께겔꼍뮷듕빗')
|
44
62
|
end
|
45
63
|
end
|
46
64
|
end
|
47
65
|
|
48
66
|
describe '.decode' do
|
49
|
-
|
50
|
-
decoded = basehangul.decode('')
|
51
|
-
expect(decoded).to eq('')
|
52
|
-
end
|
67
|
+
it_behaves_like 'a decoder', :decode
|
53
68
|
|
54
|
-
context 'when
|
69
|
+
context 'when string has wrong number of padding characters' do
|
55
70
|
it 'decodes hangul to binary' do
|
56
|
-
decoded = basehangul.decode('
|
57
|
-
expect(decoded).to eq('
|
58
|
-
decoded = basehangul.decode('
|
71
|
+
decoded = basehangul.decode('꺽')
|
72
|
+
expect(decoded).to eq('1')
|
73
|
+
decoded = basehangul.decode('꺽흐')
|
74
|
+
expect(decoded).to eq('1')
|
75
|
+
decoded = basehangul.decode('꺽흐흐')
|
76
|
+
expect(decoded).to eq('1')
|
77
|
+
decoded = basehangul.decode('꺽흐흐흐흐')
|
78
|
+
expect(decoded).to eq('1')
|
79
|
+
decoded = basehangul.decode('꺽먈')
|
80
|
+
expect(decoded).to eq('12')
|
81
|
+
decoded = basehangul.decode('꺽먹꺄')
|
82
|
+
expect(decoded).to eq('123')
|
83
|
+
decoded = basehangul.decode('꺽먹께겔꼍')
|
84
|
+
expect(decoded).to eq('123456')
|
85
|
+
decoded = basehangul.decode('꺽먹께겔꼍뮨')
|
86
|
+
expect(decoded).to eq('1234567')
|
87
|
+
decoded = basehangul.decode('꺽먹께겔꼍뮷됩')
|
88
|
+
expect(decoded).to eq('12345678')
|
89
|
+
decoded = basehangul.decode('꺽먹꼍녜흐')
|
59
90
|
expect(decoded).to eq('123ab')
|
60
|
-
decoded = basehangul.decode('
|
61
|
-
expect(decoded).to eq(
|
91
|
+
decoded = basehangul.decode('꺽먹께겔꼍뮷뒝낮흐흐')
|
92
|
+
expect(decoded).to eq('1234567890')
|
62
93
|
end
|
63
94
|
end
|
64
95
|
|
65
|
-
context 'when there are
|
66
|
-
it '
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
96
|
+
context 'when there are invalid characters' do
|
97
|
+
it 'ignores invalid characters' do
|
98
|
+
strings = [' 꺽먹꼍녜',
|
99
|
+
'꺽먹꼍녜 ',
|
100
|
+
"\n꺽\t먹\u3000꼍abc녜"]
|
101
|
+
strings.each do |encoded|
|
102
|
+
decoded = basehangul.decode(encoded)
|
103
|
+
expect(decoded).to eq('123ab')
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe '.strict_decode' do
|
110
|
+
let(:msg_invalid_char) { basehangul.const_get(:MSG_INVALID_CHAR) }
|
111
|
+
let(:msg_invalid_padding) { basehangul.const_get(:MSG_INVALID_PADDING) }
|
112
|
+
|
113
|
+
it_behaves_like 'a decoder', :strict_decode
|
114
|
+
|
115
|
+
context 'when string has wrong number of padding characters' do
|
116
|
+
it 'raises ArgumentError' do
|
117
|
+
strings = ['꺽', # rubocop:disable Style/WordArray
|
118
|
+
'꺽흐',
|
119
|
+
'꺽흐흐',
|
120
|
+
'꺽흐흐흐흐',
|
121
|
+
'꺽먈',
|
122
|
+
'꺽먹꺄',
|
123
|
+
'꺽먹께겔꼍',
|
124
|
+
'꺽먹께겔꼍뮨',
|
125
|
+
'꺽먹께겔껼뮷됩',
|
126
|
+
'꺽먹꼍녜흐',
|
127
|
+
'꺽먹께겔꼍뮷뒝낮흐흐']
|
128
|
+
strings.each do |encoded|
|
129
|
+
expect { basehangul.strict_decode(encoded) }
|
130
|
+
.to raise_error(ArgumentError, msg_invalid_padding)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
context 'when string has characters after padding characters' do
|
136
|
+
it 'raises ArgumentError' do
|
137
|
+
strings = ['꺽흐꺽흐흐흐', # rubocop:disable Style/WordArray
|
138
|
+
'꺽흐흐흐꺽흐흐흐',
|
139
|
+
'꺽먹꺄흐꺽',
|
140
|
+
'꺽먹께흐겔꼍흐흐흐',
|
141
|
+
'꺽먹꼐흐꺽먹꼐빎']
|
142
|
+
strings.each do |encoded|
|
143
|
+
expect { basehangul.strict_decode(encoded) }
|
144
|
+
.to raise_error(ArgumentError, msg_invalid_padding)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
context 'when string has special characters with wrong position' do
|
150
|
+
it 'raises ArgumentError' do
|
151
|
+
strings = ['꺽먹꼐빎꺽흐흐흐', # rubocop:disable Style/WordArray
|
152
|
+
'꺽먹빎',
|
153
|
+
'꺽먹빎흐']
|
154
|
+
strings.each do |encoded|
|
155
|
+
expect { basehangul.strict_decode(encoded) }
|
156
|
+
.to raise_error(ArgumentError, msg_invalid_padding)
|
157
|
+
end
|
73
158
|
end
|
74
159
|
end
|
75
160
|
|
76
|
-
context 'when there are
|
77
|
-
it '
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
expect(decoded).to eq('123g')
|
161
|
+
context 'when there are invalid characters' do
|
162
|
+
it 'raises ArgumentError' do
|
163
|
+
strings = [' 꺽먹꼍녜',
|
164
|
+
'꺽먹꼍녜 ',
|
165
|
+
"\n꺽\t먹\u3000꼍abc녜"]
|
166
|
+
strings.each do |encoded|
|
167
|
+
expect { basehangul.strict_decode(encoded) }
|
168
|
+
.to raise_error(ArgumentError, msg_invalid_char)
|
169
|
+
end
|
86
170
|
end
|
87
171
|
end
|
88
172
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
RSpec.shared_examples 'a decoder' do |method|
|
4
|
+
subject(:decode) { described_class.method(method) }
|
5
|
+
|
6
|
+
describe ".#{method}" do
|
7
|
+
it 'returns empty binary with empty string' do
|
8
|
+
decoded = decode.call('')
|
9
|
+
expect(decoded).to eq('')
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'when there is no padding characters' do
|
13
|
+
it 'decodes hangul to binary' do
|
14
|
+
decoded = decode.call('넥라똔먈늴멥갯놓궂뗐밸뮤뉴뗐뀄굡덜멂똑뚤')
|
15
|
+
expect(decoded).to eq('This is an encoded string')
|
16
|
+
decoded = decode.call('꺽먹꼍녜')
|
17
|
+
expect(decoded).to eq('123ab')
|
18
|
+
decoded = decode.call('꺽먹꼐가')
|
19
|
+
expect(decoded).to eq("123d\x00")
|
20
|
+
decoded = decode.call('꺽먹께겔꼍뮷뒝낮')
|
21
|
+
expect(decoded).to eq('1234567890')
|
22
|
+
decoded = decode.call('꺽먹께겔꼍뮷듕가')
|
23
|
+
expect(decoded).to eq("12345678d\x00")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when there are padding characters' do
|
28
|
+
it 'decodes hangul to binary' do
|
29
|
+
decoded = decode.call('꺽흐흐흐')
|
30
|
+
expect(decoded).to eq('1')
|
31
|
+
decoded = decode.call('꺽먈흐흐')
|
32
|
+
expect(decoded).to eq('12')
|
33
|
+
decoded = decode.call('꺽먹꺄흐')
|
34
|
+
expect(decoded).to eq('123')
|
35
|
+
decoded = decode.call('꺽먹께겔꼍흐흐흐')
|
36
|
+
expect(decoded).to eq('123456')
|
37
|
+
decoded = decode.call('꺽먹께겔꼍뮨흐흐')
|
38
|
+
expect(decoded).to eq('1234567')
|
39
|
+
decoded = decode.call('꺽먹께겔꼍뮷됩흐')
|
40
|
+
expect(decoded).to eq('12345678')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when there are special characters' do
|
45
|
+
it 'decodes hangul to binary 'do
|
46
|
+
decoded = decode.call('꺽먹꼐빎')
|
47
|
+
expect(decoded).to eq('123d')
|
48
|
+
decoded = decode.call('꺽먹꼐빔')
|
49
|
+
expect(decoded).to eq('123e')
|
50
|
+
decoded = decode.call('꺽먹꼐빕')
|
51
|
+
expect(decoded).to eq('123f')
|
52
|
+
decoded = decode.call('꺽먹꼐빗')
|
53
|
+
expect(decoded).to eq('123g')
|
54
|
+
decoded = decode.call('꺽먹께겔꼍뮷듕빎')
|
55
|
+
expect(decoded).to eq('12345678d')
|
56
|
+
decoded = decode.call('꺽먹께겔꼍뮷듕빔')
|
57
|
+
expect(decoded).to eq('12345678e')
|
58
|
+
decoded = decode.call('꺽먹께겔꼍뮷듕빕')
|
59
|
+
expect(decoded).to eq('12345678f')
|
60
|
+
decoded = decode.call('꺽먹께겔꼍뮷듕빗')
|
61
|
+
expect(decoded).to eq('12345678g')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: basehangul
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ChaYoung You
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.9'
|
83
|
-
description: BaseHangul for Ruby.
|
83
|
+
description: Human-readable binary encoding, BaseHangul for Ruby.
|
84
84
|
email:
|
85
85
|
- yousbe@gmail.com
|
86
86
|
executables: []
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- spec/basehangul_spec.rb
|
107
107
|
- spec/spec_helper.rb
|
108
108
|
- spec/support/coverage.rb
|
109
|
+
- spec/support/shared_decode.rb
|
109
110
|
homepage: ''
|
110
111
|
licenses:
|
111
112
|
- MIT
|
@@ -129,10 +130,11 @@ rubyforge_project:
|
|
129
130
|
rubygems_version: 2.4.2
|
130
131
|
signing_key:
|
131
132
|
specification_version: 4
|
132
|
-
summary: BaseHangul for Ruby.
|
133
|
+
summary: Human-readable binary encoding, BaseHangul for Ruby.
|
133
134
|
test_files:
|
134
135
|
- spec/basehangul/utils_spec.rb
|
135
136
|
- spec/basehangul/version_spec.rb
|
136
137
|
- spec/basehangul_spec.rb
|
137
138
|
- spec/spec_helper.rb
|
138
139
|
- spec/support/coverage.rb
|
140
|
+
- spec/support/shared_decode.rb
|