wcwidth 0.0.1 → 0.0.1.1
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.
- data/lib/wcwidth.rb +4 -2
- metadata +1 -1
data/lib/wcwidth.rb
CHANGED
@@ -112,13 +112,15 @@ protected
|
|
112
112
|
|
113
113
|
def mk_wcswidth
|
114
114
|
ws = self.each_char.map(&:width)
|
115
|
-
return -1 unless ws.
|
115
|
+
return -1 unless ws.all?{|x|x>=0}
|
116
116
|
ws.inject(:+)
|
117
117
|
end
|
118
118
|
|
119
119
|
public
|
120
120
|
def width
|
121
|
-
if self.size ==
|
121
|
+
if self.size == 0
|
122
|
+
0
|
123
|
+
elsif self.size == 1
|
122
124
|
self.mk_wcwidth
|
123
125
|
else
|
124
126
|
self.mk_wcswidth
|