split_with_display_width 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d57c08eca7ff23000e21fad8d14058896047f62
4
- data.tar.gz: 637ccb0c63b942ea2227fb03cd0a34595e3581b3
3
+ metadata.gz: 9767b19d49220df197b1594ad5001d90415ca4e8
4
+ data.tar.gz: 61000844d20fab4e18ad39a8413c11bbfa07cbd1
5
5
  SHA512:
6
- metadata.gz: '09670b5b7bfbb92a914ddece28415630c91920d9fd7fc00132ccb6d69896e2e13539896ab44f44ca7e3477ec7e55a1b0fd6df2eb8e36e029f47c46025c921d22'
7
- data.tar.gz: 37f32aa5009baa75225ad99bac1ede943fba671a276f2125dbb3d7519841cad52dc8cfc898ea6780aff3efc7e257c79943041a84569410b25cc3b9c98b7bd8ee
6
+ metadata.gz: af59ac4f233687821d5e27f9e7c00f2ec86f45690b6a5b01b3f09a6927a76d1171844a06d63f1e80392704d53f1d52a32c682f16e60d41be073c5b523765555f
7
+ data.tar.gz: 9877db41df392c509a6b9f357fd649917e9936dd72939527f4232dd7620da1132b4fa7bd0b0d724bdd74bfc867ee87975e3b0a9b5f1754ab680db5119110120c
@@ -1,3 +1,3 @@
1
1
  module SplitWithDisplayWidth
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -6,11 +6,13 @@ class String
6
6
 
7
7
  first = []
8
8
  second = []
9
+ flag = true
9
10
  self.each_char.each do |char|
10
11
  tmp = first + [char]
11
- if tmp.join.display_width <= num
12
+ if tmp.join.display_width <= num && flag
12
13
  first << char
13
14
  else
15
+ flag = false
14
16
  second << char
15
17
  end
16
18
  end
@@ -23,11 +25,13 @@ class String
23
25
 
24
26
  first = []
25
27
  second = []
28
+ flag = true
26
29
  self.each_char.to_a.reverse.each do |char|
27
30
  tmp = second + [char]
28
- if tmp.join.display_width <= num
31
+ if tmp.join.display_width <= num && flag
29
32
  second << char
30
33
  else
34
+ flag = false
31
35
  first << char
32
36
  end
33
37
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: split_with_display_width
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nyaahara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-24 00:00:00.000000000 Z
11
+ date: 2017-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unicode-display_width
@@ -85,6 +85,7 @@ files:
85
85
  - bin/setup
86
86
  - lib/split_with_display_width.rb
87
87
  - lib/split_with_display_width/version.rb
88
+ - split_with_display_width-1.0.0.gem
88
89
  - split_with_display_width.gemspec
89
90
  homepage: https://github.com/nyaahara/split_with_display_width
90
91
  licenses: