terminal-table 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,8 @@
1
1
 
2
+ === 1.4.1 / 2009-12-18
3
+
4
+ * Fix column alignment with separators.
5
+
2
6
  === 1.4.0 / 2009-12-18
3
7
 
4
8
  * Can now add :seperator arbitrarily in a table [thanks splattael]
@@ -179,8 +179,9 @@ module Terminal
179
179
  # Align column _n_ to the given _alignment_ of :center, :left, or :right.
180
180
 
181
181
  def align_column n, alignment
182
+ r = rows
182
183
  column(n).each_with_index do |col, i|
183
- @rows[i][n] = { :value => col, :alignment => alignment } unless Hash === col
184
+ r[i][n] = { :value => col, :alignment => alignment } unless Hash === col
184
185
  end
185
186
  end
186
187
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Terminal
3
3
  class Table
4
- VERSION = '1.4.0'
4
+ VERSION = '1.4.1'
5
5
  end
6
6
  end
@@ -121,6 +121,26 @@ module Terminal
121
121
  EOF
122
122
  end
123
123
 
124
+ it "should align columns with separators" do
125
+ @table.headings = ['Char', 'Num']
126
+ @table << ['a', 1]
127
+ @table << ['b', 2]
128
+ @table.add_separator
129
+ @table << ['c', 3]
130
+ @table.align_column 1, :right
131
+ @table.render.should == <<-EOF.deindent
132
+ +------+-----+
133
+ | Char | Num |
134
+ +------+-----+
135
+ | a | 1 |
136
+ | b | 2 |
137
+ +------+-----+
138
+ | c | 3 |
139
+ +------+-----+
140
+ EOF
141
+ end
142
+
143
+
124
144
  it "should render properly using block syntax" do
125
145
  table = Terminal::Table.new do |t|
126
146
  t << ['a', 1]
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{terminal-table}
5
- s.version = "1.4.0"
5
+ s.version = "1.4.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["TJ Holowaychuk"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal-table
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Holowaychuk