Class: Aurita::GUI::Table_Row

Inherits:
Element
  • Object
show all
Defined in:
lib/aurita-gui/table.rb

Instance Attribute Summary

Attributes inherited from Element

#attrib, #content, #parent, #tag, #type

Instance Method Summary collapse

Methods inherited from Element

#+, #clear_floating, #dom_id, #dom_id=, #each, #empty?, #id, #id=, #length, #method_missing, #to_ary

Constructor Details

#initialize(cell_data, params = {}) ⇒ Table_Row

Returns a new instance of Table_Row.



101
102
103
104
105
106
107
108
109
# File 'lib/aurita-gui/table.rb', line 101

def initialize(cell_data, params={})
  @cell_data = cell_data
  @cells = []
  @cell_data.each { |cell|
    @cells << Table_Cell.new(cell, :parent => self)
  }
  params[:tag] = 'tr'
  super(params)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Aurita::GUI::Element

Instance Method Details

#[](column_index) ⇒ Object



115
116
117
# File 'lib/aurita-gui/table.rb', line 115

def [](column_index)
  @cells[column_index]
end

#[]=(column_index, cell_data) ⇒ Object



118
119
120
# File 'lib/aurita-gui/table.rb', line 118

def []=(column_index, cell_data)
  @cells[column_index].value = cell_data
end

#inspectObject



127
128
129
# File 'lib/aurita-gui/table.rb', line 127

def inspect
  '[' << @cells.collect { |c| c.value }.join(',') + ']'
end

#stringObject



122
123
124
125
# File 'lib/aurita-gui/table.rb', line 122

def string
  @content = "\n" << @cells.collect { |c| c.string }.join()
  super()
end

#tableObject



111
112
113
# File 'lib/aurita-gui/table.rb', line 111

def table
  @params[:parent]
end