I made a Matrix class and I want to use it in various parts of my code.
class Matrix
def initialize(x, y, v=0)
@matrix = Array.new
(0..y).each do |j|
@matrix[j] = Array.new
(0..x).each do |i|
@matrix[j][i] = v
end
end
end
end
When this code is included in the same class as the code that uses it, everything runs fine.
When I move this code to lib/matrix.rb
and require it, I get the following error:
./phylograph:30:in `block in run': private method `new' called for Matrix:Class (NoMethodError)