Sha256: c97af6460537020c2ce248e1c0f252c81f6e4c9e7b15f1966b160974829c33a5

Contents?: true

Size: 374 Bytes

Versions: 239

Compression:

Stored size: 374 Bytes

Contents

module BookKeeping
  VERSION = 3
end

class Year
  attr_reader :number

  def initialize(number)
    @number = number
  end

  def self.leap?(number)
    Year.new(number).leap?
  end

  def leap?
    divisible_by?(400) || divisible_by?(4) && !divisible_by?(100)
  end

  def %(other)
    number % other
  end

  private

  def divisible_by?(i)
    (self % i) == 0
  end
end

Version data entries

239 entries across 239 versions & 1 rubygems

Version Path
trackler-2.2.1.159 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.158 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.157 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.156 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.155 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.154 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.153 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.152 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.151 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.150 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.149 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.148 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.147 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.146 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.145 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.144 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.143 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.142 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.141 tracks/ruby/exercises/leap/.meta/solutions/leap.rb
trackler-2.2.1.140 tracks/ruby/exercises/leap/.meta/solutions/leap.rb