Sha256: e9527d6f7c4ff62c2073aa2eb76518c48617529686b50bf6335b5e62322ba2f7

Contents?: true

Size: 508 Bytes

Versions: 395

Compression:

Stored size: 508 Bytes

Contents

module BookKeeping
  VERSION = 3
end

class Raindrops
  def self.convert(i)
    new(i).convert
  end

  attr_reader :number
  def initialize(number)
    @number = number
  end

  def convert
    unless pling? || plang? || plong?
      return number.to_s
    end

    s = ''
    s << 'Pling' if pling?
    s << 'Plang' if plang?
    s << 'Plong' if plong?
    s
  end

  private

  def pling?
    (number % 3) == 0
  end

  def plang?
    (number % 5) == 0
  end

  def plong?
    (number % 7) == 0
  end
end

Version data entries

395 entries across 395 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.179 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.178 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.177 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.176 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.175 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.174 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.173 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.172 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.171 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.170 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.169 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.167 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.166 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.165 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.164 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.163 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.162 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.161 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb
trackler-2.2.1.160 tracks/ruby/exercises/raindrops/.meta/solutions/raindrops.rb