Class: PostRunner::FlexiTable::Row

Inherits:
Array
  • Object
show all
Defined in:
lib/postrunner/FlexiTable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, section) ⇒ Row

Returns a new instance of Row.



115
116
117
118
119
120
# File 'lib/postrunner/FlexiTable.rb', line 115

def initialize(table, section)
  @table = table
  @section = section
  @attributes = Attributes.new
  super()
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



113
114
115
# File 'lib/postrunner/FlexiTable.rb', line 113

def attributes
  @attributes
end

Instance Method Details

#cell(content, attributes) ⇒ Object



122
123
124
125
126
# File 'lib/postrunner/FlexiTable.rb', line 122

def cell(content, attributes)
  c = Cell.new(@table, self, content, attributes)
  self << c
  c
end

#set_indicies(col_idx, row_idx) ⇒ Object



128
129
130
131
# File 'lib/postrunner/FlexiTable.rb', line 128

def set_indicies(col_idx, row_idx)
  @index = row_idx
  self[col_idx].set_indicies(col_idx, row_idx)
end

#set_row_attributes(attributes) ⇒ Object



133
134
135
# File 'lib/postrunner/FlexiTable.rb', line 133

def set_row_attributes(attributes)
  @attributes = Attributes.new(attributes)
end

#to_html(doc) ⇒ Object



148
149
150
151
152
153
154
# File 'lib/postrunner/FlexiTable.rb', line 148

def to_html(doc)
  css_class = @section == :head ? 'ft_head_row' :
              @index % 2 == 0 ? 'ft_even_row' : 'ft_odd_row'
  doc.tr({ :class => css_class }) {
    each { |c| c.to_html(doc) }
  }
end

#to_sObject



137
138
139
140
141
142
143
144
145
146
# File 'lib/postrunner/FlexiTable.rb', line 137

def to_s
  s = ''
  frame = @table.frame

  s << '|' if frame
  s << join(frame ? '|' : ' ')
  s << '|' if frame

  s
end