table_format 0.0.12 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/0190_table_print.rb +17 -0
- data/examples/0200_hankaku_katakana.rb +7 -0
- data/lib/table_format/core_ext.rb +1 -1
- data/lib/table_format/generator.rb +7 -0
- data/lib/table_format/version.rb +1 -1
- data/spec/core_ext_spec.rb +8 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 951c7faf55e91b0292ccfaa5df26a84694a35daf0d8b5d685e2fefa304de0bfe
|
4
|
+
data.tar.gz: 6bf8084836e02defeeb6da944dc0232ebb53e859e2600f28ad1a893817ad5cd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
# >> |-----|
|
@@ -27,6 +27,10 @@ module TableFormat
|
|
27
27
|
}
|
28
28
|
end
|
29
29
|
|
30
|
+
def self.table_print(str)
|
31
|
+
print str
|
32
|
+
end
|
33
|
+
|
30
34
|
def self.generate(rows, options = {})
|
31
35
|
Generator.new(rows, options).generate
|
32
36
|
end
|
@@ -163,6 +167,9 @@ module TableFormat
|
|
163
167
|
|
164
168
|
def str_width(str)
|
165
169
|
s = str.to_s
|
170
|
+
if s.encoding == Encoding.find("UTF-8")
|
171
|
+
s = s.gsub(/[ヲ-゚]/, "_") # 2byte char (hankaku katakana) -> 1byte
|
172
|
+
end
|
166
173
|
x = nil
|
167
174
|
if @options[:in_code] == Kconv::UTF8
|
168
175
|
begin
|
data/lib/table_format/version.rb
CHANGED
data/spec/core_ext_spec.rb
CHANGED
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.
|
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-
|
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
|