unicode-display_width 1.1.2 → 1.1.3
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/MIT-LICENSE.txt +1 -1
- data/README.md +1 -1
- data/lib/unicode/display_width.rb +1 -1
- data/lib/unicode/display_width/constants.rb +1 -1
- data/spec/display_width_spec.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 139f5127ef080149e50f2156bda03d18748cc384
|
4
|
+
data.tar.gz: 483e9a3386cb9b2c7f67568fb9c9b3570a8f5556
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccdd24ab36d9077cdd808ade6e44cc67fcf5c1180eab122a80ecef5aae1adf2439996701dff84d7224fb4f48d5e0ef9a8de70a97a0b7c9395afd1f5cea756ae3
|
7
|
+
data.tar.gz: 4431ed8b567006bda9418af105d666b2050845cb486b75e465990633d0ca395574fa7f2d66e7f0bdc69875bfc35f156a5f622a1e4d82ffa1149b260d46cf7044
|
data/CHANGELOG.txt
CHANGED
data/MIT-LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -96,7 +96,7 @@ See [unicode-x](https://github.com/janlelis/unicode-x) for more Unicode related
|
|
96
96
|
|
97
97
|
## Copyright & Info
|
98
98
|
|
99
|
-
- Copyright (c) 2011, 2015-
|
99
|
+
- Copyright (c) 2011, 2015-2017 Jan Lelis, http://janlelis.com, released under the MIT
|
100
100
|
license
|
101
101
|
- Early versions based on runpaint's unicode-data interface: Copyright (c) 2009 Run Paint Run Run
|
102
102
|
- Unicode data: http://www.unicode.org/copyright.html#Exhibit1
|
@@ -6,7 +6,7 @@ module Unicode
|
|
6
6
|
DEPTHS = [0x10000, 0x1000, 0x100, 0x10].freeze
|
7
7
|
|
8
8
|
def self.of(string, ambiguous = 1, overwrite = {})
|
9
|
-
res = string.
|
9
|
+
res = string.codepoints.inject(0){ |total_width, codepoint|
|
10
10
|
index_or_value = INDEX
|
11
11
|
codepoint_depth_offset = codepoint
|
12
12
|
DEPTHS.each{ |depth|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Unicode
|
2
2
|
module DisplayWidth
|
3
|
-
VERSION = '1.1.
|
3
|
+
VERSION = '1.1.3'
|
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
|
data/spec/display_width_spec.rb
CHANGED
@@ -123,4 +123,10 @@ describe 'Unicode::DisplayWidth.of' do
|
|
123
123
|
expect( "\t".display_width(1, 0x09 => 12) ).to eq 12
|
124
124
|
end
|
125
125
|
end
|
126
|
+
|
127
|
+
describe '[encoding]' do
|
128
|
+
it 'works with non-utf8 Unicode encodings' do
|
129
|
+
expect( 'À'.encode("UTF-16LE").display_width ).to eq 1
|
130
|
+
end
|
131
|
+
end
|
126
132
|
end
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.6.8
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Determines the monospace display width of a string in Ruby.
|