multiline 0.2.0 → 0.2.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
  SHA256:
3
- metadata.gz: 120e9b321bc8ee21dd0baef7c9795c76b18efaef94c5873f043b30b4769515c4
4
- data.tar.gz: d8363e7df7ecbac0ae47017261dd27245562126d1c5005a9b55d4dc4e0dbe12e
3
+ metadata.gz: 7e4b279e2d4c27090f9424529c28b260862d04de2444aa2f83cad11f28819c6e
4
+ data.tar.gz: e5be0628c69c379a768e1100c0cc16aa032c30c6c9a73743624255e5b05a3c94
5
5
  SHA512:
6
- metadata.gz: fedf659662908421d78f321fd4a81093dab8e1e907da6bca566dcf48391976ff285698291f47d07f35de6e3d9d79db3dd3fe003e15a43b114369ed71438693b4
7
- data.tar.gz: 77afa7ad629335f4b502cff4157799b31af504260727371c027e8d59a77f1665242bc9fc9111d48863f2b8b53d321732a7f6c23dd32289f893d8125c5d657a1f
6
+ metadata.gz: f4c27c453f9c182349aa46195b41c44423a9d7958bcce8b3dbe61fc2f9f0b9e150eb9e59a7983b45a6bc3959e9cf10a4690016ed8b9e7b0c380b373a26abc2bb
7
+ data.tar.gz: 85dc0fa3fcb1f1b0ace95209415ce2e2896066dcb84392a149895671882b8762cbba413cb5caeb8b02fad7d6474a79c7e66ee68698a6b71f35f9f84469e78e78
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- multiline (0.2.0)
4
+ multiline (0.2.1)
5
5
  unicode-display_width
6
6
  unicode-emoji
7
7
 
data/lib/multiline.rb CHANGED
@@ -6,5 +6,23 @@ require "multiline/string"
6
6
  require "multiline/array"
7
7
 
8
8
  module Multiline
9
+ def self.config=(config)
10
+ @config = config
11
+ end
12
+
13
+ def self.config
14
+ @config
15
+ end
16
+
9
17
  class Error < StandardError; end
18
+ class Configure
19
+ attr_accessor :display_width_ambiguous, :display_width_overwrite
20
+
21
+ def initialize
22
+ self.display_width_ambiguous = 1
23
+ self.display_width_overwrite = {}
24
+ end
25
+ end
10
26
  end
27
+
28
+ Multiline.config = Multiline::Configure.new
@@ -4,8 +4,12 @@ module Multiline
4
4
  def initialize(str = "")
5
5
  @buf = str.split(/\n/)
6
6
  @row = @buf.count || 0
7
- @col = @buf.map{|line| Unicode::DisplayWidth.of(line) }.max || 0
8
- @buf = @buf.map{|line| line + " " * (@col - Unicode::DisplayWidth.of(line)) }
7
+ @col = @buf.map{|line| Unicode::DisplayWidth.of(line,
8
+ Multiline.config.display_width_ambiguous,
9
+ Multiline.config.display_width_overwrite) }.max || 0
10
+ @buf = @buf.map{|line| line + " " * (@col - Unicode::DisplayWidth.of(line,
11
+ Multiline.config.display_width_ambiguous,
12
+ Multiline.config.display_width_overwrite)) }
9
13
  end
10
14
 
11
15
  def +(other)
@@ -1,3 +1,3 @@
1
1
  module Multiline
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toshio Maki