dynamically calling method that takes array as parameters
I've a method like

      def method (a=[],b=[])
       ...
      end

I am calling this method with variables like this 

             method(h[0].values_at("value"), h[1].values_at("value")) 
where h[0] and h[1] are hashes. It works fine.

 Heres the issue, I dont know if h[1] is going to be there in the next run. So its giving me error if hash h[1] is not there

How can i modify it so it makes the call dynamically depending on whether h[0], h[1] are there or not and call the method with correct number of parameters.

Thanks

        
dynamically calling method that takes array as parameters
===

I've a method like

      def method (a=[],b=[])
       ...
      end

I am calling this method with variables like this 

             method(h[0].values_at("value"), h[1].values_at("value")) 
where h[0] and h[1] are hashes. It works fine.

 Heres the issue, I dont know if h[1] is going to be there in the next run. So its giving me error if hash h[1] is not there

How can i modify it so it makes the call dynamically depending on whether h[0], h[1] are there or not and call the method with correct number of parameters.

Thanks

        