html-table 1.3.3 → 1.3.4

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.
data/lib/html/content.rb CHANGED
@@ -1,18 +1,18 @@
1
- ########################################################################
2
- # content.rb
3
- #
4
- # This class handles content for Table::Row::Data, Table::Row::Header,
5
- # and Table::Row::Caption objects.
6
- ########################################################################
7
- require 'tag_handler'
8
-
9
- module HTML
10
- class Table::Content < String
11
- include TagHandler
12
-
13
- def initialize(string, &block)
14
- super(string)
15
- instance_eval(&block) if block_given?
16
- end
17
- end
18
- end
1
+ ########################################################################
2
+ # content.rb
3
+ #
4
+ # This class handles content for Table::Row::Data, Table::Row::Header,
5
+ # and Table::Row::Caption objects.
6
+ ########################################################################
7
+ require File.join(File.dirname(__FILE__), 'tag_handler')
8
+
9
+ module HTML
10
+ class Table::Content < String
11
+ include TagHandler
12
+
13
+ def initialize(string, &block)
14
+ super(string)
15
+ instance_eval(&block) if block_given?
16
+ end
17
+ end
18
+ end
data/lib/html/data.rb CHANGED
@@ -1,68 +1,68 @@
1
- module HTML
2
-
3
- # This class represents HTML table data, <td>. Despite the name
4
- # it is not a subclass of Table::Row or Table.
5
- #
6
- class Table::Row::Data
7
- include AttributeHandler
8
- include HtmlHandler
9
-
10
- undef_method :configure
11
-
12
- @indent_level = 6
13
- @end_tags = true
14
-
15
- # Creates and returns a Data object. Optionally takes a block. If
16
- # an argument is provided, it is treated as content.
17
- #
18
- def initialize(arg = nil, &block)
19
- @html_begin = '<td'
20
- @html_body = ''
21
- @html_end = '</td>'
22
- instance_eval(&block) if block_given?
23
- self.content = arg if arg
24
- end
25
-
26
- # Adds content to the Table::Row::Data object.
27
- #
28
- def content=(arg)
29
- @html_body = Table::Content.new(arg.to_s)
30
- end
31
-
32
- # Returns the indentation level for the tags of this class. The
33
- # default is 6.
34
- #
35
- def self.indent_level
36
- @indent_level
37
- end
38
-
39
- # Sets the indentation level for the tags of this class. The default
40
- # is 6.
41
- #
42
- def self.indent_level=(num)
43
- expect(num,Integer)
44
- raise ArgumentError,"indent_level must be >= 0" if num < 0
45
- @indent_level = num
46
- end
47
-
48
- # Returns a boolean indicating whether or not end tags, </td>, are
49
- # included for each Data object in the final HTML output. The
50
- # default is true.
51
- #
52
- def self.end_tags?
53
- @end_tags
54
- end
55
-
56
- # Sets whether or not end tags are included for each Data object in
57
- # the final HTML output. The default is true. Only true or false are
58
- # valid arguments.
59
- #
60
- def self.end_tags=(bool)
61
- expect(bool,[TrueClass,FalseClass])
62
- @end_tags = bool
63
- end
64
-
65
- alias to_s html
66
- alias to_str html
67
- end
68
- end
1
+ module HTML
2
+
3
+ # This class represents HTML table data, <td>. Despite the name
4
+ # it is not a subclass of Table::Row or Table.
5
+ #
6
+ class Table::Row::Data
7
+ include AttributeHandler
8
+ include HtmlHandler
9
+
10
+ undef_method :configure
11
+
12
+ @indent_level = 6
13
+ @end_tags = true
14
+
15
+ # Creates and returns a Data object. Optionally takes a block. If
16
+ # an argument is provided, it is treated as content.
17
+ #
18
+ def initialize(arg = nil, &block)
19
+ @html_begin = '<td'
20
+ @html_body = ''
21
+ @html_end = '</td>'
22
+ instance_eval(&block) if block_given?
23
+ self.content = arg if arg
24
+ end
25
+
26
+ # Adds content to the Table::Row::Data object.
27
+ #
28
+ def content=(arg)
29
+ @html_body = Table::Content.new(arg.to_s)
30
+ end
31
+
32
+ # Returns the indentation level for the tags of this class. The
33
+ # default is 6.
34
+ #
35
+ def self.indent_level
36
+ @indent_level
37
+ end
38
+
39
+ # Sets the indentation level for the tags of this class. The default
40
+ # is 6.
41
+ #
42
+ def self.indent_level=(num)
43
+ expect(num,Integer)
44
+ raise ArgumentError,"indent_level must be >= 0" if num < 0
45
+ @indent_level = num
46
+ end
47
+
48
+ # Returns a boolean indicating whether or not end tags, </td>, are
49
+ # included for each Data object in the final HTML output. The
50
+ # default is true.
51
+ #
52
+ def self.end_tags?
53
+ @end_tags
54
+ end
55
+
56
+ # Sets whether or not end tags are included for each Data object in
57
+ # the final HTML output. The default is true. Only true or false are
58
+ # valid arguments.
59
+ #
60
+ def self.end_tags=(bool)
61
+ expect(bool,[TrueClass,FalseClass])
62
+ @end_tags = bool
63
+ end
64
+
65
+ alias to_s html
66
+ alias to_str html
67
+ end
68
+ end
data/lib/html/foot.rb CHANGED
@@ -1,49 +1,49 @@
1
- module HTML
2
-
3
- # This class represents an HTML table foot (<tfoot>). It is a
4
- # subclass of Table::TableSection. It is a singleton class.
5
- #
6
- class Table::Foot < Table::TableSection
7
- private_class_method :new
8
-
9
- @@foot = nil
10
- @indent_level = 3
11
- @end_tags = true
12
-
13
- # This is our constructor for Foot objects because it is a singleton
14
- # class. Optionally, a block may be provided. If an argument is
15
- # provided it is treated as content.
16
- #
17
- def self.create(arg=nil, &block)
18
- @@foot = new(arg, &block) unless @@foot
19
- @@foot
20
- end
21
-
22
- # Called by create() instead of new(). This initializes the Foot class.
23
- #
24
- def initialize(arg, &block)
25
- @html_begin = "<tfoot"
26
- @html_end = "</tfoot>"
27
- instance_eval(&block) if block_given?
28
- self.content = arg if arg
29
- end
30
-
31
- # Returns a boolean indicating whether or not end tags, </tfoot>, are
32
- # included for each Foot object in the final HTML output. The
33
- # default is true.
34
- #
35
- def self.end_tags?
36
- @end_tags
37
- end
38
-
39
- # Sets whether or not end tags are included for each Foot object in
40
- # the final HTML output. The default is true. Only true or false are
41
- # valid arguments.
42
- #
43
- def self.end_tags=(bool)
44
- expect(bool, [TrueClass,FalseClass])
45
- @end_tags = bool
46
- end
47
- end
48
-
49
- end
1
+ module HTML
2
+
3
+ # This class represents an HTML table foot (<tfoot>). It is a
4
+ # subclass of Table::TableSection. It is a singleton class.
5
+ #
6
+ class Table::Foot < Table::TableSection
7
+ private_class_method :new
8
+
9
+ @@foot = nil
10
+ @indent_level = 3
11
+ @end_tags = true
12
+
13
+ # This is our constructor for Foot objects because it is a singleton
14
+ # class. Optionally, a block may be provided. If an argument is
15
+ # provided it is treated as content.
16
+ #
17
+ def self.create(arg=nil, &block)
18
+ @@foot = new(arg, &block) unless @@foot
19
+ @@foot
20
+ end
21
+
22
+ # Called by create() instead of new(). This initializes the Foot class.
23
+ #
24
+ def initialize(arg, &block)
25
+ @html_begin = "<tfoot"
26
+ @html_end = "</tfoot>"
27
+ instance_eval(&block) if block_given?
28
+ self.content = arg if arg
29
+ end
30
+
31
+ # Returns a boolean indicating whether or not end tags, </tfoot>, are
32
+ # included for each Foot object in the final HTML output. The
33
+ # default is true.
34
+ #
35
+ def self.end_tags?
36
+ @end_tags
37
+ end
38
+
39
+ # Sets whether or not end tags are included for each Foot object in
40
+ # the final HTML output. The default is true. Only true or false are
41
+ # valid arguments.
42
+ #
43
+ def self.end_tags=(bool)
44
+ expect(bool, [TrueClass,FalseClass])
45
+ @end_tags = bool
46
+ end
47
+ end
48
+
49
+ end
data/lib/html/head.rb CHANGED
@@ -1,49 +1,49 @@
1
- module HTML
2
-
3
- # This class represents an HTML table head (<thead>). It is a
4
- # subclass of Table::TableSection. It is a singleton class.
5
- #
6
- class Table::Head < Table::TableSection
7
- private_class_method :new
8
-
9
- @@head = nil
10
-
11
- @indent_level = 3
12
- @end_tags = true
13
-
14
- # This is our constructor for Head objects because it is a singleton
15
- # class. Optionally, a block may be provided. If an argument is
16
- # provided it is treated as content.
17
- #
18
- def self.create(arg=nil, &block)
19
- @@head = new(arg, &block) unless @@head
20
- @@head
21
- end
22
-
23
- # Called by create() instead of new(). This initializes the Head class.
24
- #
25
- def initialize(arg, &block)
26
- @html_begin = "<thead"
27
- @html_end = "</thead>"
28
- instance_eval(&block) if block_given?
29
- self.content = arg if arg
30
- end
31
-
32
- # Returns a boolean indicating whether or not end tags, </thead>, are
33
- # included for each Head object in the final HTML output. The
34
- # default is true.
35
- #
36
- def self.end_tags?
37
- @end_tags
38
- end
39
-
40
- # Sets whether or not end tags are included for each Head object in
41
- # the final HTML output. The default is true. Only true or false are
42
- # valid arguments.
43
- #
44
- def self.end_tags=(bool)
45
- expect(bool,[TrueClass,FalseClass])
46
- @end_tags = bool
47
- end
48
- end
49
- end
1
+ module HTML
2
+
3
+ # This class represents an HTML table head (<thead>). It is a
4
+ # subclass of Table::TableSection. It is a singleton class.
5
+ #
6
+ class Table::Head < Table::TableSection
7
+ private_class_method :new
8
+
9
+ @@head = nil
10
+
11
+ @indent_level = 3
12
+ @end_tags = true
13
+
14
+ # This is our constructor for Head objects because it is a singleton
15
+ # class. Optionally, a block may be provided. If an argument is
16
+ # provided it is treated as content.
17
+ #
18
+ def self.create(arg=nil, &block)
19
+ @@head = new(arg, &block) unless @@head
20
+ @@head
21
+ end
22
+
23
+ # Called by create() instead of new(). This initializes the Head class.
24
+ #
25
+ def initialize(arg, &block)
26
+ @html_begin = "<thead"
27
+ @html_end = "</thead>"
28
+ instance_eval(&block) if block_given?
29
+ self.content = arg if arg
30
+ end
31
+
32
+ # Returns a boolean indicating whether or not end tags, </thead>, are
33
+ # included for each Head object in the final HTML output. The
34
+ # default is true.
35
+ #
36
+ def self.end_tags?
37
+ @end_tags
38
+ end
39
+
40
+ # Sets whether or not end tags are included for each Head object in
41
+ # the final HTML output. The default is true. Only true or false are
42
+ # valid arguments.
43
+ #
44
+ def self.end_tags=(bool)
45
+ expect(bool,[TrueClass,FalseClass])
46
+ @end_tags = bool
47
+ end
48
+ end
49
+ end
data/lib/html/header.rb CHANGED
@@ -1,65 +1,65 @@
1
- module HTML
2
-
3
- # This class represents an HTML table header (<th>). Despite the name
4
- # it is not a subclass of Table or Table::Row.
5
- #
6
- class Table::Row::Header
7
- include AttributeHandler
8
- include HtmlHandler
9
-
10
- undef_method :configure
11
-
12
- @indent_level = 6
13
- @end_tags = true
14
-
15
- # Creates and returns a new Header object. Optionally takes a block.
16
- # If an argument is provided, it is treated as content.
17
- #
18
- def initialize(arg = nil, &block)
19
- @html_begin = '<th'
20
- @html_body = ''
21
- @html_end = '</th>'
22
- instance_eval(&block) if block_given?
23
- self.content = arg if arg
24
- end
25
-
26
- # Adds content to the Table::Row::Header object.
27
- #
28
- def content=(arg)
29
- @html_body = Table::Content.new(arg.to_s)
30
- end
31
-
32
- # Returns the indentation level for the tags of this class. The
33
- # default is 6.
34
- #
35
- def self.indent_level
36
- @indent_level
37
- end
38
-
39
- # Sets the indentation level for the tags of this class. The default
40
- # is 6.
41
- #
42
- def self.indent_level=(num)
43
- expect(num,Integer)
44
- raise ArgumentError,"indent_level must be >= 0" if num < 0
45
- @indent_level = num
46
- end
47
-
48
- # Returns a boolean indicating whether or not end tags are included for
49
- # each Header object in the final HTML output. The default is true.
50
- #
51
- def self.end_tags?
52
- @end_tags
53
- end
54
-
55
- # Sets whether or not end tags are included for each Header object in
56
- # the final HTML output. The default is true. Only true or false are
57
- # valid arguments.
58
- #
59
- def self.end_tags=(bool)
60
- expect(bool,[TrueClass,FalseClass])
61
- @end_tags = bool
62
- end
63
- end
64
-
65
- end
1
+ module HTML
2
+
3
+ # This class represents an HTML table header (<th>). Despite the name
4
+ # it is not a subclass of Table or Table::Row.
5
+ #
6
+ class Table::Row::Header
7
+ include AttributeHandler
8
+ include HtmlHandler
9
+
10
+ undef_method :configure
11
+
12
+ @indent_level = 6
13
+ @end_tags = true
14
+
15
+ # Creates and returns a new Header object. Optionally takes a block.
16
+ # If an argument is provided, it is treated as content.
17
+ #
18
+ def initialize(arg = nil, &block)
19
+ @html_begin = '<th'
20
+ @html_body = ''
21
+ @html_end = '</th>'
22
+ instance_eval(&block) if block_given?
23
+ self.content = arg if arg
24
+ end
25
+
26
+ # Adds content to the Table::Row::Header object.
27
+ #
28
+ def content=(arg)
29
+ @html_body = Table::Content.new(arg.to_s)
30
+ end
31
+
32
+ # Returns the indentation level for the tags of this class. The
33
+ # default is 6.
34
+ #
35
+ def self.indent_level
36
+ @indent_level
37
+ end
38
+
39
+ # Sets the indentation level for the tags of this class. The default
40
+ # is 6.
41
+ #
42
+ def self.indent_level=(num)
43
+ expect(num,Integer)
44
+ raise ArgumentError,"indent_level must be >= 0" if num < 0
45
+ @indent_level = num
46
+ end
47
+
48
+ # Returns a boolean indicating whether or not end tags are included for
49
+ # each Header object in the final HTML output. The default is true.
50
+ #
51
+ def self.end_tags?
52
+ @end_tags
53
+ end
54
+
55
+ # Sets whether or not end tags are included for each Header object in
56
+ # the final HTML output. The default is true. Only true or false are
57
+ # valid arguments.
58
+ #
59
+ def self.end_tags=(bool)
60
+ expect(bool,[TrueClass,FalseClass])
61
+ @end_tags = bool
62
+ end
63
+ end
64
+
65
+ end