unicode-display_width 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.txt +4 -0
- data/lib/unicode/display_width.rb +4 -2
- data/lib/unicode/display_width/constants.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e98df13369d5af8117d07c174c4c8b50804e083
|
4
|
+
data.tar.gz: b4d058625eaeb72fa7c3ac21e1c57b645133ee5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4788d4fd57d12278fc92dc73f011a47f1572ac38b5e933d0bb03535a44e988a27e0dc37f265c968a9a0010d59e8e8f29a063eeb19bed1f935e4c7781f476be12
|
7
|
+
data.tar.gz: fc663563f837ef8802b4967a044269c2585f99eed98fc0da8a0570427b93f671c6e37932b4ead6bbeeb91b2302dd5b76a0d9fb87c0f5bd5ae76bf59ef20bccfe
|
data/CHANGELOG.txt
CHANGED
@@ -3,11 +3,13 @@ require_relative 'display_width/index'
|
|
3
3
|
|
4
4
|
module Unicode
|
5
5
|
module DisplayWidth
|
6
|
+
DEPTHS = [0x10000, 0x1000, 0x100, 0x10].freeze
|
7
|
+
|
6
8
|
def self.of(string, ambiguous = 1, overwrite = {})
|
7
|
-
res = string.unpack('U*').inject(0){ |total_width, codepoint|
|
9
|
+
res = string.unpack('U*'.freeze).inject(0){ |total_width, codepoint|
|
8
10
|
index_or_value = INDEX
|
9
11
|
codepoint_depth_offset = codepoint
|
10
|
-
|
12
|
+
DEPTHS.each{ |depth|
|
11
13
|
index_or_value = index_or_value[codepoint_depth_offset / depth]
|
12
14
|
codepoint_depth_offset = codepoint_depth_offset % depth
|
13
15
|
break unless index_or_value.is_a? Array
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Unicode
|
2
2
|
module DisplayWidth
|
3
|
-
VERSION = '1.1.
|
3
|
+
VERSION = '1.1.2'
|
4
4
|
UNICODE_VERSION = "9.0.0".freeze
|
5
5
|
DATA_DIRECTORY = File.expand_path(File.dirname(__FILE__) + '/../../../data/').freeze
|
6
6
|
INDEX_FILENAME = (DATA_DIRECTORY + '/display_width.marshal.gz').freeze
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicode-display_width
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09
|
11
|
+
date: 2016-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|