module Numpy::Conversion

Public Instance Methods

to_ruby(val) click to toggle source
# File lib/numpy/conversion.rb, line 5
def to_ruby(val)
  case val
  when Numpy.integer
    PyCall.builtins.int.(val)
  when Numpy.floating
    PyCall.builtins.float.(val)
  when Numpy.complexfloating
    val = PyCall.builtins.complex.(val)
    Complex(val.real.to_f, val.imag.to_f)
  when Numpy.bool_
    PyCall.builtins.bool.(val)
  else
    val
  end
end