Class: StHtmlTable::Cell
- Inherits:
-
Object
- Object
- StHtmlTable::Cell
- Defined in:
- lib/st_html_table/cell.rb
Instance Attribute Summary collapse
-
#align ⇒ Object
Returns the value of attribute align.
-
#bold ⇒ Object
Returns the value of attribute bold.
-
#col_id ⇒ Object
Returns the value of attribute col_id.
-
#cols ⇒ Object
Returns the value of attribute cols.
-
#is_header ⇒ Object
Returns the value of attribute is_header.
-
#italic ⇒ Object
Returns the value of attribute italic.
-
#row ⇒ Object
readonly
Returns the value of attribute row.
-
#row_id ⇒ Object
Returns the value of attribute row_id.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
-
#text ⇒ Object
Returns the value of attribute text.
-
#type ⇒ Object
Returns the value of attribute type.
-
#valign ⇒ Object
Returns the value of attribute valign.
Instance Method Summary collapse
-
#initialize(table, row) ⇒ Cell
constructor
A new instance of Cell.
- #prefix=(value) ⇒ Object
- #suffix=(value) ⇒ Object
- #to_html ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(table, row) ⇒ Cell
Returns a new instance of Cell.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/st_html_table/cell.rb', line 16 def initialize(table, row) @text = ' ' @row = row @table = table @is_header = false @cols = 1 @col_id = 0 @row_id = 0 @type = :neutral @valign = :top @bold = false @italic = false @align = :left @ident = 6 end |
Instance Attribute Details
#align ⇒ Object
Returns the value of attribute align.
12 13 14 |
# File 'lib/st_html_table/cell.rb', line 12 def align @align end |
#bold ⇒ Object
Returns the value of attribute bold.
10 11 12 |
# File 'lib/st_html_table/cell.rb', line 10 def bold @bold end |
#col_id ⇒ Object
Returns the value of attribute col_id.
8 9 10 |
# File 'lib/st_html_table/cell.rb', line 8 def col_id @col_id end |
#cols ⇒ Object
Returns the value of attribute cols.
7 8 9 |
# File 'lib/st_html_table/cell.rb', line 7 def cols @cols end |
#is_header ⇒ Object
Returns the value of attribute is_header.
6 7 8 |
# File 'lib/st_html_table/cell.rb', line 6 def is_header @is_header end |
#italic ⇒ Object
Returns the value of attribute italic.
11 12 13 |
# File 'lib/st_html_table/cell.rb', line 11 def italic @italic end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
4 5 6 |
# File 'lib/st_html_table/cell.rb', line 4 def row @row end |
#row_id ⇒ Object
Returns the value of attribute row_id.
9 10 11 |
# File 'lib/st_html_table/cell.rb', line 9 def row_id @row_id end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
5 6 7 |
# File 'lib/st_html_table/cell.rb', line 5 def table @table end |
#text ⇒ Object
Returns the value of attribute text.
3 4 5 |
# File 'lib/st_html_table/cell.rb', line 3 def text @text end |
#type ⇒ Object
Returns the value of attribute type.
14 15 16 |
# File 'lib/st_html_table/cell.rb', line 14 def type @type end |
#valign ⇒ Object
Returns the value of attribute valign.
13 14 15 |
# File 'lib/st_html_table/cell.rb', line 13 def valign @valign end |
Instance Method Details
#prefix=(value) ⇒ Object
34 35 36 |
# File 'lib/st_html_table/cell.rb', line 34 def prefix=(value) @prefix = value end |
#suffix=(value) ⇒ Object
38 39 40 |
# File 'lib/st_html_table/cell.rb', line 38 def suffix=(value) @suffix = value end |
#to_html ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/st_html_table/cell.rb', line 46 def to_html type = @is_header ? 'th' : 'td' out = Array.new out << (' ' * @ident) + build_cell_arguments(type) out << (' ' * (@ident + 2)) + @text.to_s out << (' ' * @ident) + "</#{type}>" out.join("\n") end |
#to_s ⇒ Object
42 43 44 |
# File 'lib/st_html_table/cell.rb', line 42 def to_s @text.gsub(%r{</?[^>]+?>}, '') end |