Get terminal rows and columns

 @return [Array[Integer, Integer]]
   return rows & columns

 @api public
491095
def size
      size = size_from_java
      size ||= size_from_win_api
      size ||= size_from_ioctl
      size ||= size_from_io_console
      size ||= size_from_readline
      size ||= size_from_tput
      size ||= size_from_stty
      size ||= size_from_env
      size ||= size_from_ansicon
      size ||  DEFAULT_SIZE
    end
1342490
def colformat(strings, num_sep_spaces=1, terminal_width=None):
    """"""
    if terminal_width is None:
        terminal_width = get_terminal_size().columns

    if not strings:
        return

    num_items = len(strings)
    max_len = max([len(strip_ansi_escapes(s)) for s in strings])

    num_columns = min(
        int((terminal_width + num_sep_spaces) / (max_len + num_sep_spaces)),
        num_items)
    num_columns = max(1, num_columns)

    num_lines = int(math.ceil(float(num_items) / num_columns))
    num_columns = int(math.ceil(float(num_items) / num_lines))

    num_elements_last_column = num_items % num_lines
    if num_elements_last_column == 0:
        num_elements_last_column = num_lines

    lines = []
    for i in range(num_lines):
        line_size = num_columns
        if i >= num_elements_last_column:
            line_size -= 1
        lines.append([None] * line_size)

    for i, line in enumerate(lines):
        line_size = len(line)
        for j in range(line_size):
            k = i + num_lines * j
            item = strings[k]
            if j % line_size != line_size - 1:
                item_len = len(strip_ansi_escapes(item))
                item = item + ' ' * (max_len - item_len)
            line[j] = item

    sep = ' ' * num_sep_spaces
    for line in lines:
        yield sep.join(line)
1161980
def [](cell_def)
      return rows[cell_def] if cell_def.is_a?(Integer)
      parts = cell_def.split(':').map{ |part| name_to_cell part }
      if parts.size == 1
        parts.first
      else
        range(*parts)
      end
    end
831364
def rows(self) -> List[List[str]]:
        
        return [list(d.values()) for d in self.data]
1093061
def _get_size(self):
        
        if self._chan is None:
            return Size(rows=20, columns=79)
        else:
            width, height, pixwidth, pixheight = self._chan.get_terminal_size()
            return Size(rows=height, columns=width)
173935
def build
      results = [%w[Field Type Null Default]]
      @klass.columns_hash.each do |name, column|
        default = case column.default
        when NilClass then ''
        when TrueClass then '1'
        when FalseClass then '0'
        else column.default
        end
        results << [name, column.sql_type, column.null ? 'YES' : 'NO', default]
      end
      lengths = results.transpose.map { |list| list.max_by { |segment| segment.to_s.length }.length + 1 }
      
      definition = results.map do |line|
        '# ' + line.map.with_index { |segment, index| "| %-#{lengths[index]}s" % segment }.join + "|\n"
      end
      header_line = '# ' + lengths.map { |length| '+' + '-' * (length + 1) }.join + "+\n"
      [header_line, definition.first, header_line] + definition[1..-1] + [header_line]
    end
1152942
protected function columns()
    {
        $this->data    = $this->setData();
        $column_widths = $this->getColumnWidths();
        $output        = [];
        $count         = count(reset($this->data));

        for ($i = 0; $i < $count; $i++) {
            $output[] = $this->getRow($i, $column_widths);
        }

        return $output;
    }
270283
function() {
            	var v = [];
            	
            	for(var i = 1; i <= this.cols(); i++) {
            	    for(var j = 1; j <= this.rows(); j++) {
            		v.push(this.e(j, i));
            	    }
            	}

            	return $V(v);
                }
414666
def getDatabases(self):
        
        cur = self._conn.cursor()
        cur.execute("""SHOW DATABASES;""")
        rows = cur.fetchall()
        if rows:
            return [row[0] for row in rows]
        else:
            return []
422352
def <<(row)
      if row == Border::SEPARATOR
        separators << columns_size - (header ? 0 : 2)
      else
        rows_copy = rows.dup
        assert_row_sizes rows_copy << row
        rows << to_row(row)
      end
      self
    end
1287121
function() {
      var array = [],
          i, j, ilen, jlen;
      for(i = 0, ilen = this.elements.length; i < ilen; i++) {
        var row = [];
        for(j = 0, jlen = this.column_names.length; j < jlen ; j++) {
          row.push( this.elements[i][ this.column_names[j] ] );
        }
        array.push(row);
      }
      return array;
    }
260049
def get_cell_lines(self, column_idx):
        '''
            
        '''
        return [] if column_idx >= len(self.columns) else self.columns[column_idx].get_cell_lines()
231488
def pluck(*cols)
      options = cols.last.is_a?(Hash) ? cols.pop : {}
      @options.merge!(options)
      @options[:symbolize_keys] = true
      self.iterate_type(options[:class]) if options[:class]
      cols    = cols.map {|c| c.to_sym }
      result  = []

      self.each() do |row|
        row = row.symbolize_keys if row.is_a?(Hash)
        result << cols.map { |c| row[c] }
      end

      result.flatten! if cols.size == 1
      result
    end
1344432
def fetch_rows
    state[:chunksize] = fetch_chunksize
    ds = table.order(*order_by).limit(state[:chunksize], state[:offset])
    log.debug "DataStream#fetch_rows SQL -> #{ds.sql}"
    rows = Taps::Utils.format_data(ds.all,
      :string_columns => string_columns,
      :schema => db.schema(table_name),
      :table  => table_name
    )
    update_chunksize_stats
    rows
  end
181214
function() {
                	var matrix_rows = [];
                	var n = this.elements.length;
                	for (var i = 0; i < n; i++) {
                    matrix_rows.push(this.elements[i]);
                	}
                  return matrix_rows;
                }
129093
public ArrayList<String> getRows() {
		ArrayList<String> rows = new ArrayList<String>();
		for (String row : rowLookup.keySet()) {
			HeaderInfo hi = rowLookup.get(row);
			if (!hi.isHide()) {
				rows.add(row);
			}
		}
		return rows;
	}
101913
def get_rows(self, sort=False):
        
        ret = []
        for _, rows in sorted(self._rows.items()) if sort else self._rows.items():
            self._rows_int2date(rows)
            ret.extend(rows)

        return ret