Class RFits::ColumnInformationList
In: lib/rfits/rfits.rb
Parent: Object

A list of ColumnInformation objects representing the set of column definitions. Behaves much like an array.

Methods

<<   []   []=   delete   each   new   size  

Included Modules

Enumerable

Attributes

table  [R]  The table the columns belong to.

Public Class methods

Create a list of ColumnInformation from the specified table.

 cil = ColumnInformationList.new(table)

Public Instance methods

Append a new column to the table. See ColumnInformationList#[]= for details on what "options" can look like.

 cil << {:name => 'new_column_1', :format => 'A10'}
 cil << [{:name => 'new_column_1', :format => 'A10'}, {:name => 'new_column_2', :format => 'I'}]

Retrieve the ith column‘s information.

 cil[1]  # the second column's information

Insert a column into the ith position. "options" is a hash with two keys:

:name
the name of the column
:format
the format of the column as explained in the cfitsio documentation

You can also insert multiple columns at the same time by passing an array of hashes of the format explained above.

 cil[1] = {:name => 'new_column_1', :format => 'A10'}
 cil[1] = [{:name => 'new_column_1', :format => 'A10'}, {:name => 'new_column_2', :format => 'I'}]

Delete the ith column.

 cil.delete(1)  # delete the second column

The number of columns in the table.

 cil.size  # 4

[Validate]