terminal-table 1.4.5 → 1.5.0
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.
- checksums.yaml +7 -0
- data/History.rdoc +48 -54
- data/Manifest +0 -4
- data/README.rdoc +240 -240
- data/Rakefile +14 -14
- data/Todo.rdoc +13 -13
- data/examples/examples.rb +83 -80
- data/lib/terminal-table.rb +2 -2
- data/lib/terminal-table/cell.rb +7 -9
- data/lib/terminal-table/import.rb +4 -4
- data/lib/terminal-table/table.rb +14 -8
- data/lib/terminal-table/table_helper.rb +9 -9
- data/lib/terminal-table/version.rb +1 -1
- data/spec/cell_spec.rb +12 -6
- data/spec/import_spec.rb +1 -1
- data/spec/spec_helper.rb +8 -8
- data/spec/table_spec.rb +54 -7
- data/tasks/docs.rake +12 -12
- data/tasks/gemspec.rake +2 -2
- data/tasks/spec.rake +24 -24
- data/terminal-table.gemspec +6 -5
- metadata +53 -63
- data/lib/terminal-table/core_ext.rb +0 -8
- data/lib/terminal-table/row.rb +0 -48
- data/lib/terminal-table/separator.rb +0 -14
- data/lib/terminal-table/style.rb +0 -61
- data/spec/core_ext_spec.rb +0 -18
- data/spec/spec.opts +0 -1
data/lib/terminal-table/style.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
|
2
|
-
module Terminal
|
3
|
-
class Table
|
4
|
-
# A Style object holds all the formatting information for a Table object
|
5
|
-
#
|
6
|
-
# To create a table with a certain style, use either the constructor
|
7
|
-
# option <tt>:style</tt>, the Table#style object or the Table#style= method
|
8
|
-
#
|
9
|
-
# All these examples have the same effect:
|
10
|
-
#
|
11
|
-
# # by constructor
|
12
|
-
# @table = Table.new(:style => {:padding_left => 2, :width => 40})
|
13
|
-
#
|
14
|
-
# # by object
|
15
|
-
# @table.style.padding_left = 2
|
16
|
-
# @table.style.width = 40
|
17
|
-
#
|
18
|
-
# # by method
|
19
|
-
# @table.style = {:padding_left => 2, :width => 40}
|
20
|
-
#
|
21
|
-
# To set a default style for all tables created afterwards use Style.defaults=
|
22
|
-
#
|
23
|
-
# Terminal::Table::Style.defaults = {:width => 80}
|
24
|
-
#
|
25
|
-
class Style
|
26
|
-
@@defaults = {
|
27
|
-
:border_x => "-", :border_y => "|", :border_i => "+",
|
28
|
-
:padding_left => 1, :padding_right => 1,
|
29
|
-
:width => nil
|
30
|
-
}
|
31
|
-
|
32
|
-
attr_accessor :border_x
|
33
|
-
attr_accessor :border_y
|
34
|
-
attr_accessor :border_i
|
35
|
-
|
36
|
-
attr_accessor :padding_left
|
37
|
-
attr_accessor :padding_right
|
38
|
-
|
39
|
-
attr_accessor :width
|
40
|
-
|
41
|
-
|
42
|
-
def initialize options = {}
|
43
|
-
apply self.class.defaults.merge(options)
|
44
|
-
end
|
45
|
-
|
46
|
-
def apply options
|
47
|
-
options.each { |m, v| __send__ "#{m}=", v }
|
48
|
-
end
|
49
|
-
|
50
|
-
class << self
|
51
|
-
def defaults
|
52
|
-
@@defaults
|
53
|
-
end
|
54
|
-
|
55
|
-
def defaults= options
|
56
|
-
@@defaults = defaults.merge(options)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
data/spec/core_ext_spec.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe String do
|
5
|
-
describe "#align" do
|
6
|
-
it "should center" do
|
7
|
-
'foo'.align(:center, 10).should == ' foo '
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should align left" do
|
11
|
-
'foo'.align(:left, 10).should == 'foo '
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should align right" do
|
15
|
-
'foo'.align(:right, 10).should == ' foo'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|