Sha256: 590f1c857c0c3a0a4788e94e294268948a3791f5c183beaefeea0d3fc9ef81e3
Contents?: true
Size: 529 Bytes
Versions: 9
Compression:
Stored size: 529 Bytes
Contents
module Math # def self.min(array, &block) if block_given? if min = array.find{ |i| i } min = yield(min) array.each do |i| j = yield(i) min = j if min > j end min end else array.min end end # def self.max(array, block) if block_given? if max = find{|i| i} max = yield(max) each{|i| j = yield(i) max = j if max < j } max end else array.max end end end
Version data entries
9 entries across 8 versions & 2 rubygems