unicode-display_width 2.0.0.pre2 → 2.0.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/CHANGELOG.md +5 -0
- data/README.md +9 -9
- data/lib/unicode/display_width/constants.rb +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3945bec5d99b8d50f0cc813980a8b7e37c8f08c1d12fed49081f1b852714d91
|
4
|
+
data.tar.gz: 063dc046d0bb0f6b0cd5adba3aa62a67f0e0c561c8dbce24b532d5c9a961fa58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37865fa1e94b4423cdbb276f3c9b9fb7c53012df5db61248c779316e038b581bb69513161ff27a708b796cffff3658dc98b29efb4de817b50e1ae0725e2c6396
|
7
|
+
data.tar.gz: deaebc021969062929c203c95bda9c4b23510b4153f78805729eefc7b3ce0444da3aba0d748a430b64786842c5a80bef5fad6778df03b35669cfcd10dd84495d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
## Unicode::DisplayWidth [![[version]](https://badge.fury.io/rb/unicode-display_width.svg)](https://badge.fury.io/rb/unicode-display_width) [<img src="https://
|
1
|
+
## Unicode::DisplayWidth [![[version]](https://badge.fury.io/rb/unicode-display_width.svg)](https://badge.fury.io/rb/unicode-display_width) [<img src="https://github.com/janlelis/unicode-display_width/workflows/Test/badge.svg" />](https://github.com/janlelis/unicode-display_width/actions?query=workflow%3ATest)
|
2
2
|
|
3
3
|
Determines the monospace display width of a string in Ruby. Implementation based on [EastAsianWidth.txt](https://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt) and other data, 100% in Ruby. It does not rely on the OS vendor (like [wcwidth()](https://github.com/janlelis/wcswidth-ruby)) to provide an up-to-date method for measuring string width.
|
4
4
|
|
5
5
|
Unicode version: **13.0.0** (March 2020)
|
6
6
|
|
7
|
-
Supported Rubies: **2.7**, **2.6**, **2.5
|
7
|
+
Supported Rubies: **3.0**, **2.7**, **2.6**, **2.5**
|
8
8
|
|
9
|
-
Old Rubies which might still work: **2.3**, **2.2**, **2.1**, **2.0**, **1.9**
|
9
|
+
Old Rubies which might still work: **2.4**, **2.3**, **2.2**, **2.1**, **2.0**, **1.9**
|
10
10
|
|
11
|
-
## Version 2.0
|
11
|
+
## Version 2.0 — Breaking Changes
|
12
12
|
|
13
|
-
Some features of this library
|
13
|
+
Some features of this library were marked deprecated for a long time and have been removed with Version 2.0:
|
14
14
|
|
15
15
|
- Aliases of display_width (…\_size, …\_length) have been removed
|
16
16
|
- Auto-loading of string core extension has been removed:
|
@@ -18,7 +18,7 @@ Some features of this library have been marked deprecated for a long time and wi
|
|
18
18
|
If you are relying on the `String#display_width` string extension to be automatically loaded (old behavior), please load it explicitly now:
|
19
19
|
|
20
20
|
```ruby
|
21
|
-
require "unicode
|
21
|
+
require "unicode/display_width/string_ext"
|
22
22
|
```
|
23
23
|
|
24
24
|
You could also change your `Gemfile` line to achieve this:
|
@@ -91,14 +91,14 @@ Unicode::DisplayWidth.of("a\tb", 1, "\t".ord => 10)) # => tab counted as 10, so
|
|
91
91
|
|
92
92
|
#### Emoji Support
|
93
93
|
|
94
|
-
|
94
|
+
Emoji width support is included, but in must be activated manually. It will adjust the string's size for modifier and zero-width joiner sequences. You also need to add the [unicode-emoji](https://github.com/janlelis/unicode-emoji) gem to your Gemfile:
|
95
95
|
|
96
96
|
```ruby
|
97
97
|
gem 'unicode-display_width'
|
98
98
|
gem 'unicode-emoji'
|
99
99
|
```
|
100
100
|
|
101
|
-
|
101
|
+
Enable the emoji string width adjustments by passing `emoji: true` as fourth parameter:
|
102
102
|
|
103
103
|
```ruby
|
104
104
|
Unicode::DisplayWidth.of "🤾🏽♀️" # => 5
|
@@ -124,7 +124,7 @@ require 'unicode/display_width'
|
|
124
124
|
display_width = Unicode::DisplayWidth.new(
|
125
125
|
# ambiguous: 1,
|
126
126
|
overwrite: { "A".ord => 100 },
|
127
|
-
emoji: true
|
127
|
+
emoji: true,
|
128
128
|
)
|
129
129
|
|
130
130
|
display_width.of "⚀" # => 1
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module Unicode
|
4
4
|
class DisplayWidth
|
5
|
-
VERSION = "2.0.0
|
6
|
-
UNICODE_VERSION = "13.0.0"
|
5
|
+
VERSION = "2.0.0"
|
6
|
+
UNICODE_VERSION = "13.0.0"
|
7
7
|
DATA_DIRECTORY = File.expand_path(File.dirname(__FILE__) + "/../../../data/")
|
8
8
|
INDEX_FILENAME = DATA_DIRECTORY + "/display_width.marshal.gz"
|
9
9
|
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: 2.0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
description: "[Unicode 13.0.0] Determines the monospace display width of a string
|
42
42
|
using EastAsianWidth.txt, Unicode general category, and other data."
|
43
43
|
email:
|
@@ -76,11 +76,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
76
|
version: 1.9.3
|
77
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- - "
|
79
|
+
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: '0'
|
82
82
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
83
|
+
rubygems_version: 3.2.3
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Determines the monospace display width of a string in Ruby.
|