Sha256: 619391d237337ee954a900edbb62e2cfcce07e31538dd1120421d521817fdf5a
Contents?: true
Size: 362 Bytes
Versions: 129
Compression:
Stored size: 362 Bytes
Contents
module BookKeeping VERSION = 2 end class SumOfMultiples attr_reader :multiples def initialize(*multiples) @multiples = multiples end def to(limit) sum = 0 (1...limit).each do |i| sum += i if multiple?(i) end sum end private def multiple?(i) multiples.any? do |multiple| i % multiple == 0 end end end
Version data entries
129 entries across 129 versions & 1 rubygems