Class: HTML::Table::TableSection

Inherits:
Array
  • Object
show all
Extended by:
Mixin::StrongTyping
Includes:
Mixin::AttributeHandler, Mixin::HtmlHandler, Mixin::StrongTyping
Defined in:
lib/html/tablesection.rb

Overview

Superclass for THEAD, TBODY, TFOOT

Direct Known Subclasses

Table::Body, Table::Foot, Table::Head

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixin::StrongTyping

expect

Methods included from Mixin::HtmlHandler

#html

Methods included from 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(&block) ⇒ TableSection

Returns a new instance of TableSection.



12
13
14
15
# File 'lib/html/tablesection.rb', line 12

def initialize(&block)
  super
  instance_eval(&block) if block_given?
end

Class Method Details

.indent_levelObject



25
26
27
# File 'lib/html/tablesection.rb', line 25

def self.indent_level
  @indent_level
end

.indent_level=(num) ⇒ Object

Raises:

  • (ArgumentError)


29
30
31
32
33
# File 'lib/html/tablesection.rb', line 29

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

#[]=(index, obj) ⇒ Object



35
36
37
38
# File 'lib/html/tablesection.rb', line 35

def []=(index, obj)
  expect(obj, Table::Row)
  super
end

#content=(arg) ⇒ Object

Adds a Table::Row object as content. The arg is passed as the value to the Table::Row constructor.



20
21
22
23
# File 'lib/html/tablesection.rb', line 20

def content=(arg)
  tr = Table::Row.new(arg)
  push(tr)
end

#push(*args) ⇒ Object



40
41
42
43
# File 'lib/html/tablesection.rb', line 40

def push(*args)
  args.each { |obj| expect(obj, Table::Row) }
  super
end

#unshift(obj) ⇒ Object



45
46
47
48
# File 'lib/html/tablesection.rb', line 45

def unshift(obj)
  expect(obj, Table::Row)
  super
end