table_format 0.0.13 → 0.0.16

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: f00e1e8399327b1651abb33fa72c06400843fd3e04aae71ac36fef66b3f2e2ef
4
+ data.tar.gz: f0379b5f92615fcb0215eb04a73260448461a08fef2accea59c0832d38145846
5
5
  SHA512:
6
- metadata.gz: dcdd03294f59ad8859740d6eeb324d460048ce88d27f63c8bf86930ff65bcfbfab147bf6dfc5fca0a8bcbb10d4589e3aae59f9c854b259eb0fa2d7143a07e4e6
7
- data.tar.gz: d9f854cf8c0bdab14b54cb4566ba74ce7583de8ea1593772191ba5ccfb8bfed66cf2aeae43ad3715965c35ab469973cf1e2365cd0aace66b4c52157c5f4e7e1c
6
+ metadata.gz: fb056ac12dcb67bd0c69f90c0154d261c99b04d3095b6975e4136b8348f925dc96bc91edb53eaa204fe2342e4bf76bc064207d4ab3b08af3e4aa2b12185450d3
7
+ data.tar.gz: 92d165bf8fb20f2b6d30bc39e570cfe9e4618f48216dc79383d2ba4891149d40461cb55eb3ddb26b7510893bd48f9a1a1812b559a3883e171d71687d4529897b
@@ -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
+ # >> |---|
@@ -1,3 +1,4 @@
1
+ require 'active_support'
1
2
  require 'active_support/core_ext/kernel/concern'
2
3
 
3
4
  module TableFormat
@@ -1,13 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Workaround of:
4
- # uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState
5
- begin
6
- require 'active_support/isolated_execution_state'
7
- rescue LoadError
8
- end
9
-
10
- require 'active_support/core_ext/string' # for blank?
3
+ require 'active_support'
4
+ require 'active_support/core_ext/object/blank' # for blank?
11
5
  require 'active_support/core_ext/class/attribute' # for class_attribute
12
6
  require 'kconv'
13
7
 
@@ -167,6 +161,9 @@ module TableFormat
167
161
 
168
162
  def str_width(str)
169
163
  s = str.to_s
164
+ if s.encoding == Encoding.find("UTF-8")
165
+ s = s.gsub(/[ヲ-゚]/, "_") # 2byte char (hankaku katakana) -> 1byte
166
+ end
170
167
  x = nil
171
168
  if @options[:in_code] == Kconv::UTF8
172
169
  begin
@@ -1,3 +1,3 @@
1
1
  module TableFormat
2
- VERSION = '0.0.13'
2
+ VERSION = '0.0.16'
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.16
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: 2023-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -113,7 +113,9 @@ files:
113
113
  - examples/0150_line_break.rb
114
114
  - examples/0160_truncate.rb
115
115
  - examples/0170_emoji.rb
116
- - examples/0180_object_spec.rb
116
+ - examples/0180_object.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
@@ -148,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
150
  - !ruby/object:Gem::Version
149
151
  version: '0'
150
152
  requirements: []
151
- rubygems_version: 3.3.4
153
+ rubygems_version: 3.4.12
152
154
  signing_key:
153
155
  specification_version: 4
154
156
  summary: TableFormat shows text table like emacs org-table for easy reading.
File without changes