Module: Matrix::ConversionHelper
Do not use. This module is for internal use only.
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Extended In:
| |
Included In:
| |
Defined in: | lib/matrix.rb |
Overview
Private helper modules
Instance Method Summary
-
#convert_to_array(obj, copy = false)
private
Converts the obj to an Array.
Instance Method Details
#convert_to_array(obj, copy = false) (private)
Converts the obj to an Array. If copy is set to true a copy of obj will be made if necessary.
# File 'lib/matrix.rb', line 1665
private def convert_to_array(obj, copy = false) # :nodoc: case obj when Array copy ? obj.dup : obj when Vector obj.to_a else begin converted = obj.to_ary rescue Exception => e raise TypeError, "can't convert #{obj.class} into an Array (#{e.})" end raise TypeError, "#{obj.class}#to_ary should return an Array" unless converted.is_a? Array converted end end