Class: SimpleTable::Cell

Inherits:
Tag
  • Object
show all
Defined in:
lib/simple_table/cell.rb

Instance Attribute Summary collapse

Attributes inherited from Tag

#options, #parent

Instance Method Summary collapse

Methods inherited from Tag

#add_class, #collection_class, #collection_name, #head?, #table

Constructor Details

#initialize(parent, content = nil, options = {}) ⇒ Cell

Returns a new instance of Cell.



7
8
9
10
11
# File 'lib/simple_table/cell.rb', line 7

def initialize(parent, content = nil, options = {})
  super(parent, options)
  @content = content
  options[:colspan] = table.columns.size if options[:colspan] == :all
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



5
6
7
# File 'lib/simple_table/cell.rb', line 5

def content
  @content
end

Instance Method Details

#renderObject



13
14
15
# File 'lib/simple_table/cell.rb', line 13

def render
  super(content, true)
end

#tag_nameObject



17
18
19
# File 'lib/simple_table/cell.rb', line 17

def tag_name
  parent.head? ? :th : :td
end