Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

RVariable

smidget edited this page Jul 19, 2012 · 3 revisions

This class represents OpenSHAPA variables (columns) in Ruby. Each variable has an array called cells that contains cells in RCell format. The basic way to access these cells is to loop over them, for example:

# First get the variable from the OpenSHAPA 
# database and load it into a Ruby object called var
var = getVariable("trial")  

# Now we loop over all of the cells
for cell in var.cells
    # puts is a simple command for printing whatever 
    # comes after it to the console
    puts var.ordinal  
end

will print out the ordinal of each cell. Not super exciting, but it shows how easy it is to loop over each cell.

Properties

The RVariable class stores several properties that the user can access.

cells

The cells list is what stores the RCell instances that this variable contains. This is the most important attribute of the RVariable class.

arglist

arglist stores a list of all of the matrix arguments for this variable. This is mostly used internally, but is exposed for users to access in case they need to loop over all of the arguments in a variable.

db_var

The actual Variable class from Java that is stored in this variable. This is nil if this is a new variable.