# File lib/instance_methods.rb, line 86 def map rng = nil, function = :linear, &b # :yields: next_codon ... if block_given? if rng raise ArgumentError, "both block and #{rng} passed to map", caller end arity = b.arity case arity # these are here, and also ordered, for efficiencies sake when 1 yield next_codon when 2 yield next_codon, next_codon when 0, -1 raise ArgumentError, 'block given to map must have 1 or more arguments', caller else yield *Array.new(arity) { next_codon } end else Utils::map rng, next_codon, function end end