table_format 0.0.13 → 0.0.15

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: d285d1d841ae5700ba051400f09a25ceaa659f19dd18dd66a49d4bc144b70e8b
4
- data.tar.gz: 3e053fae7087684f6cca90bca8b473cf50da0e77ee417bf708ec5423cb050268
3
+ metadata.gz: 951c7faf55e91b0292ccfaa5df26a84694a35daf0d8b5d685e2fefa304de0bfe
4
+ data.tar.gz: 6bf8084836e02defeeb6da944dc0232ebb53e859e2600f28ad1a893817ad5cd2
5
5
  SHA512:
6
- metadata.gz: dcdd03294f59ad8859740d6eeb324d460048ce88d27f63c8bf86930ff65bcfbfab147bf6dfc5fca0a8bcbb10d4589e3aae59f9c854b259eb0fa2d7143a07e4e6
7
- data.tar.gz: d9f854cf8c0bdab14b54cb4566ba74ce7583de8ea1593772191ba5ccfb8bfed66cf2aeae43ad3715965c35ab469973cf1e2365cd0aace66b4c52157c5f4e7e1c
6
+ metadata.gz: 1f795872dbcf42d7acf6258118eaaf5c2dc15023babbd126eaa06b93dde939a413bccc4039242dc3681a115df62ba5ac8fc75bb2b715ea1db273cb0f98ee794d
7
+ data.tar.gz: b881f75d76c2beb947de2af4ea902772da60de79ed11e058d34d4154ba1d7d0bd835edec6e8ed3b040bd20c7810878d951a8a69cf842cc227134a398d356469e
@@ -0,0 +1,17 @@
1
+ $LOAD_PATH << '../lib'
2
+ require 'table_format'
3
+
4
+ require "active_support/logger"
5
+
6
+ AppLogger = ActiveSupport::Logger.new(STDOUT)
7
+
8
+ module TableFormat
9
+ def self.table_print(str)
10
+ AppLogger.debug(str.rstrip)
11
+ end
12
+ end
13
+
14
+ tp "foo"
15
+ # >> |-----|
16
+ # >> | foo |
17
+ # >> |-----|
@@ -0,0 +1,7 @@
1
+ $LOAD_PATH << '../lib'
2
+ require 'table_format'
3
+
4
+ tp "ア"
5
+ # >> |---|
6
+ # >> | ア |
7
+ # >> |---|
@@ -167,6 +167,9 @@ module TableFormat
167
167
 
168
168
  def str_width(str)
169
169
  s = str.to_s
170
+ if s.encoding == Encoding.find("UTF-8")
171
+ s = s.gsub(/[ヲ-゚]/, "_") # 2byte char (hankaku katakana) -> 1byte
172
+ end
170
173
  x = nil
171
174
  if @options[:in_code] == Kconv::UTF8
172
175
  begin
@@ -1,3 +1,3 @@
1
1
  module TableFormat
2
- VERSION = '0.0.13'
2
+ VERSION = '0.0.15'
3
3
  end
@@ -23,6 +23,14 @@ describe TableFormat do
23
23
  |------+------|
24
24
  | i... | 1... |
25
25
  |------+------|
26
+ EOT
27
+ end
28
+
29
+ it 'hankaku katakana' do
30
+ capture(:stdout) { tp("ア") }.should == <<~EOT
31
+ |---|
32
+ | ア |
33
+ |---|
26
34
  EOT
27
35
  end
28
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - akicho8
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-16 00:00:00.000000000 Z
11
+ date: 2022-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -114,6 +114,8 @@ files:
114
114
  - examples/0160_truncate.rb
115
115
  - examples/0170_emoji.rb
116
116
  - examples/0180_object_spec.rb
117
+ - examples/0190_table_print.rb
118
+ - examples/0200_hankaku_katakana.rb
117
119
  - lib/table_format.rb
118
120
  - lib/table_format/core_ext.rb
119
121
  - lib/table_format/generator.rb