terminal-table 1.4.5 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -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