Class: Table::Row::Header
- Inherits:
-
Object
- Object
- Table::Row::Header
- Extended by:
- HTML::Mixin::StrongTyping
- Defined in:
- lib/html/header.rb
Overview
This class represents an HTML table header (<th>). Despite the name it is not a subclass of Table or Table::Row.
Class Method Summary collapse
-
.end_tags=(bool) ⇒ Object
Sets whether or not end tags are included for each Header object in the final HTML output.
-
.end_tags? ⇒ Boolean
Returns a boolean indicating whether or not end tags are included for each Header object in the final HTML output.
-
.indent_level ⇒ Object
Returns the indentation level for the tags of this class.
-
.indent_level=(num) ⇒ Object
Sets the indentation level for the tags of this class.
Instance Method Summary collapse
-
#content=(arg) ⇒ Object
Adds content to the Table::Row::Header object.
-
#initialize(arg = nil, &block) ⇒ Header
constructor
Creates and returns a new Header object.
Methods included from HTML::Mixin::StrongTyping
Methods included from HTML::Mixin::HtmlHandler
Methods included from HTML::Mixin::AttributeHandler
#abbr, #abbr=, #align, #align=, #axis, #axis=, #background, #background=, #bgcolor, #bgcolor=, #border, #border=, #bordercolor, #bordercolor=, #bordercolordark, #bordercolordark=, #bordercolorlight, #bordercolorlight=, #cellpadding, #cellpadding=, #cellspacing, #cellspacing=, #char, #char=, #charoff, #charoff=, #class_, #class_=, #col, #col=, #colspan, #colspan=, #configure, #content, #frame, #frame=, #height, #height=, #hspace, #hspace=, #nowrap, #nowrap=, #rowspan, #rowspan=, #rules, #rules=, #span, #span=, #style, #style=, #summary, #summary=, #valign, #valign=, #vspace, #vspace=, #width, #width=
Constructor Details
#initialize(arg = nil, &block) ⇒ Header
Creates and returns a new Header object. Optionally takes a block. If an argument is provided, it is treated as content.
20 21 22 23 24 25 26 |
# File 'lib/html/header.rb', line 20 def initialize(arg = nil, &block) @html_begin = '<th' @html_body = '' @html_end = '</th>' instance_eval(&block) if block_given? self.content = arg if arg end |
Class Method Details
.end_tags=(bool) ⇒ Object
Sets whether or not end tags are included for each Header object in the final HTML output. The default is true. Only true or false are valid arguments.
62 63 64 65 |
# File 'lib/html/header.rb', line 62 def self.=(bool) expect(bool, [TrueClass, FalseClass]) = bool end |
.end_tags? ⇒ Boolean
Returns a boolean indicating whether or not end tags are included for each Header object in the final HTML output. The default is true.
54 55 56 |
# File 'lib/html/header.rb', line 54 def self. end |
.indent_level ⇒ Object
Returns the indentation level for the tags of this class. The default is 6.
38 39 40 |
# File 'lib/html/header.rb', line 38 def self.indent_level @indent_level end |
.indent_level=(num) ⇒ Object
Sets the indentation level for the tags of this class. The default is 6.
45 46 47 48 49 |
# File 'lib/html/header.rb', line 45 def self.indent_level=(num) expect(num, Integer) raise ArgumentError, 'indent_level must be >= 0' if num < 0 @indent_level = num end |
Instance Method Details
#content=(arg) ⇒ Object
Adds content to the Table::Row::Header object.
30 31 32 33 |
# File 'lib/html/header.rb', line 30 def content=(arg) arg = arg.is_a?(Array) ? arg.join : arg.to_s @html_body = Table::Content.new(arg) end |