Object
Call the given block for every entry of the array and its predecessor. The block is supposed to accept two parameters. The block is not called at all if the array’s length is less than two.
$ irb >> require 'plantwatchdog/aggregation_methods' => true >> [].each_prior{|x,y| x+y} => [] >> [1].each_prior{|x,y| x+y} => [] >> [1,2].each_prior{|x,y| x+y} => [3] >> [1,2,3].each_prior{|x,y| x+y} => [3, 5]
# File lib/plantwatchdog/aggregation_methods.rb, line 35 def each_prior() i=0 result=[] while (i < self.size-1) do result << yield(self[i],self[i+1]) i+=1 end return result end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.