mercredi 6 mai 2015

I have an array called p1 as below:

p1= [512, 2048]

I'm passing p1 to test method as below:

test(p1)

test method definition looks as below:

def test(value)
  if value.kind_of?(Array)
    value.each do |proto|
      puts"******#{proto}"
    end
  end
end

The above code execution is throwing the error:

#<NoMethodError: undefined methodto_i' for [512, 2048]:Array>

What could be the reason for it?

Aucun commentaire:

Enregistrer un commentaire