unicode-display_width 1.1.2 → 1.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e98df13369d5af8117d07c174c4c8b50804e083
4
- data.tar.gz: b4d058625eaeb72fa7c3ac21e1c57b645133ee5a
3
+ metadata.gz: 139f5127ef080149e50f2156bda03d18748cc384
4
+ data.tar.gz: 483e9a3386cb9b2c7f67568fb9c9b3570a8f5556
5
5
  SHA512:
6
- metadata.gz: 4788d4fd57d12278fc92dc73f011a47f1572ac38b5e933d0bb03535a44e988a27e0dc37f265c968a9a0010d59e8e8f29a063eeb19bed1f935e4c7781f476be12
7
- data.tar.gz: fc663563f837ef8802b4967a044269c2585f99eed98fc0da8a0570427b93f671c6e37932b4ead6bbeeb91b2302dd5b76a0d9fb87c0f5bd5ae76bf59ef20bccfe
6
+ metadata.gz: ccdd24ab36d9077cdd808ade6e44cc67fcf5c1180eab122a80ecef5aae1adf2439996701dff84d7224fb4f48d5e0ef9a8de70a97a0b7c9395afd1f5cea756ae3
7
+ data.tar.gz: 4431ed8b567006bda9418af105d666b2050845cb486b75e465990633d0ca395574fa7f2d66e7f0bdc69875bfc35f156a5f622a1e4d82ffa1149b260d46cf7044
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.1.3
4
+
5
+ - Fix that non-UTF-8 encodings do not throw errors, patch by @windwiny
6
+
3
7
  ## 1.1.2
4
8
 
5
9
  - Reduce memory consumption and increase performance, patch by @rrosenblum
@@ -1,6 +1,6 @@
1
1
  The MIT LICENSE
2
2
 
3
- Copyright (c) 2011, 2015-2016 Jan Lelis
3
+ Copyright (c) 2011, 2015-2017 Jan Lelis
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
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-2016 Jan Lelis, http://janlelis.com, released under the MIT
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.unpack('U*'.freeze).inject(0){ |total_width, codepoint|
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.2'
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
@@ -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.2
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: 2016-12-09 00:00:00.000000000 Z
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.4.8
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.