Class: Zgomot::UI::TableRowWindow

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/zgomot/ui/windows.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#set_color, #write

Constructor Details

#initialize(values, widths, color, top, value_color = COLOR_BORDER) ⇒ TableRowWindow

Returns a new instance of TableRowWindow.



371
372
373
374
375
376
377
378
379
380
# File 'lib/zgomot/ui/windows.rb', line 371

def initialize(values, widths, color, top, value_color = COLOR_BORDER)
  left = 0
  @columns = (0..widths.length-1).reduce([]) do|rs, i|
                width = widths[i]
                value = values.nil? ? '' : values[i]
                win = TableCellWindow.new(value, color, width, top, left, value_color)
                left += width
                rs << win
            end
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



370
371
372
# File 'lib/zgomot/ui/windows.rb', line 370

def color
  @color
end

#columnsObject (readonly)

Returns the value of attribute columns.



370
371
372
# File 'lib/zgomot/ui/windows.rb', line 370

def columns
  @columns
end

#value_colorObject (readonly)

Returns the value of attribute value_color.



370
371
372
# File 'lib/zgomot/ui/windows.rb', line 370

def value_color
  @value_color
end

#valuesObject (readonly)

Returns the value of attribute values.



370
371
372
# File 'lib/zgomot/ui/windows.rb', line 370

def values
  @values
end

#widthsObject (readonly)

Returns the value of attribute widths.



370
371
372
# File 'lib/zgomot/ui/windows.rb', line 370

def widths
  @widths
end

#windowObject (readonly)

Returns the value of attribute window.



370
371
372
# File 'lib/zgomot/ui/windows.rb', line 370

def window
  @window
end

Instance Method Details

#display(values, value_color) ⇒ Object



381
382
383
384
385
# File 'lib/zgomot/ui/windows.rb', line 381

def display(values, value_color)
  (0..columns.length-1).each do |i|
    columns[i].display(values[i], value_color)
  end
end