terminal-table-unicode 0.1.0 → 0.1.2

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
  SHA1:
3
- metadata.gz: bfbb9d722b0dce32d8677ae6cfb24a32c6f8edcc
4
- data.tar.gz: e6ed0733d12e7aa0d8dd7789d43a3a1a6344cf08
3
+ metadata.gz: 85dffa2fb12bbba3b8efdceea67ec82776aa3af6
4
+ data.tar.gz: 7cd63232652fac37666a5605c4af76970407de5a
5
5
  SHA512:
6
- metadata.gz: 66d64e24776584ccd94df3c2da6a7677a66347c62a1556c6d31fb7805d65f9b33ee602c19878393bd89e1536b2a053c87fc2b01a2c81d28caa1aeeaada6eccd0
7
- data.tar.gz: fb76b53657778d9153fcceaa58b68a90aa4eeca3829805c1bc1977aa3ba97dd33b117457e053d22bad667a255736b0583fe1753cd4f170cbfaefb75c219e6b7f
6
+ metadata.gz: 9dbc0ba8e48d9bb0e3343b220fd737a68f2d45d2f5a3cde20ee12ecd231da3fc30fb24a78eb144cfb42fb89ac31ead04e86ea3dc2b1b52204f06f3340e39cc8e
7
+ data.tar.gz: 5009fe1aaa42ff693228fa0c1bdd99941508802f87912572609c104909965064afd4159249aabcba66d381e8a5116dd7b599f9fc9cdbd4e31e7c2918655837c1
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # terminal-table-unicode
2
2
 
3
- [tj/terminal-table](https://github.com/tj/terminal-table) is a great rubygems. But it has a probrem that can deal with [full-width unicode characters](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms#Fullwidth_form). terminal-table-unicode solved that.
3
+ [tj/terminal-table](https://github.com/tj/terminal-table) is an awesome rubygem. But it has a probrem that can deal with [full-width unicode characters](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms#Fullwidth_form). terminal-table-unicode solved that.
4
4
  I referred to [miaout17/hirb-unicode](https://github.com/miaout17/hirb-unicode).
5
5
 
6
6
  ## Installation
@@ -32,18 +32,12 @@ table = Terminal::Table.new :rows => rows
32
32
  puts table
33
33
  ```
34
34
 
35
- ```ruby
36
- +-------+---+
37
- | One | 1 |
38
- | Two | 2 |
39
- | Three | 3 |
40
- | よん | 4 |
41
- +-------+---+
42
- ```
35
+ ![terminal-table-unicode_example.png](https://gist.githubusercontent.com/rochefort/8ea4a216dca2194b9411/raw/e0ce829b02e3808a6484f5738fc5476f02601df5/terminal-table-unicode_example.png)
36
+
43
37
 
44
38
  You can use with other options.
45
39
  see more: [tj/terminal-table](https://github.com/tj/terminal-table)
46
40
 
47
41
  ## Contributing
48
42
 
49
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/terminal-table-unicode.
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rochefort/terminal-table-unicode.
@@ -1,13 +1,11 @@
1
1
  module Terminal
2
2
  class Table
3
3
  class Cell
4
-
5
4
  def align(val, position, length)
6
5
  # positions = { :left => :ljust, :right => :rjust, :center => :center }
7
- positions = { :left => :mb_ljust, :right => :mb_rjust, :center => :mb_center }
6
+ positions = { left: :mb_ljust, right: :mb_rjust, center: :mb_center }
8
7
  val.public_send(positions[position], length)
9
8
  end
10
-
11
9
  end
12
10
  end
13
11
  end
@@ -1,21 +1,4 @@
1
1
  class String
2
- def display_width(ambiguous = 1)
3
- #codepoints.inject(0){ |a,c|
4
- unpack('U*').inject(0){ |a,c|
5
- width = case Unicode::DisplayWidth.codepoint(c).to_s
6
- when *%w[F W]
7
- 2
8
- when *%w[N Na H]
9
- 1
10
- when *%w[A] # TODO
11
- ambiguous
12
- else
13
- 1
14
- end
15
- a + width
16
- }
17
- end
18
-
19
2
  def mb_ljust(desired_width)
20
3
  padding = desired_width - display_width
21
4
  padding > 0 ? self + ' ' * padding : self
@@ -1,7 +1,7 @@
1
1
  module Terminal
2
2
  class Table
3
3
  module Unicode
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.2'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal-table-unicode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rochefort
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-15 00:00:00.000000000 Z
11
+ date: 2015-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: terminal-table
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  requirements: []
110
110
  rubyforge_project:
111
- rubygems_version: 2.4.5
111
+ rubygems_version: 2.4.8
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Simple, feature rich ascii table generation library with full-width unicode