Project

General

Profile

Actions

Feature #14151

closed

Make Matrix#[]= public method

Added by greggzst (Grzegorz Jakubiak) almost 7 years ago. Updated about 6 years ago.

Status:
Closed
Target version:
-
[ruby-core:84062]

Description

I don't even understand why this method hasn't been public since the beginning. I've come to a point when I have to create a matrix in a specific way using row and column indices and I can't use #build with a block because then indices go from the beginning of matrix whereas I have to from the center of the matrix. So what I wanted to do is to create a zero matrix and the fill it in a proper way but I can't without using #[]=. I know I can reopen class and that's what I'm doing but this just doesn't make sense. If we can change elements in an array like so using #[]= then why matrices can't use that as well?

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0