Class: RETerm::Components::Matrix

Inherits:
RETerm::Component show all
Includes:
RETerm::CDKComponent
Defined in:
lib/reterm/components/matrix.rb

Overview

CDK Matrix Component

Instance Attribute Summary

Attributes inherited from RETerm::Component

#window

Instance Method Summary collapse

Methods included from RETerm::CDKComponent

#activatable?, #activate!, #colors=, #component, #draw!, #value

Methods inherited from RETerm::Component

#activatable?, #activate!, #colored?, #colors=, #finalize!

Constructor Details

#initialize(args = {}) ⇒ Matrix

Initialize the Matrix component

Parameters:

  • args (Hash) (defaults to: {})

    matrix params



10
11
12
13
14
15
16
17
18
19
# File 'lib/reterm/components/matrix.rb', line 10

def initialize(args={})
  @rows  = args[:rows]
  @cols  = args[:cols]
  @title = args[:title]

  @rowtitles = args[:rowtitles] || args[:row_titles] || Array.new(@rows) { "" }
  @coltitles = args[:coltitles] || args[:col_titles] || Array.new(@cols+1) { "" }
  @colwidths = args[:colwidths] || args[:col_widths] || Array.new(@cols+1) { 5 }
  @coltypes  = args[:coltypes]  || args[:col_types]  || Array.new(@cols+1) { :UMIXED }
end

Instance Method Details

#get(x, y) ⇒ Object



21
22
23
# File 'lib/reterm/components/matrix.rb', line 21

def get(x, y)
  component.getCell(x, y)
end