Sha256: 1f253f7ee2fa9b53f9a903e90f2912f9dfcc8a8899bb44d8aa885201052a8038
Contents?: true
Size: 394 Bytes
Versions: 4
Compression:
Stored size: 394 Bytes
Contents
module Streamer module Functors # Divide divides two terms class Divide < Functor def call divide end def divide terms = numerify(options.fetch(:terms)) fail 'Streamer::Functor# divide: too many terms' if terms.size > 2 return 0.0 if terms.any? { |t| t.to_f == 0.0 } terms[0].to_f / terms[1].to_f end end end end
Version data entries
4 entries across 4 versions & 1 rubygems