Sha256: baae1f3ea52083d0b20bc5f22ede510cf9056fd6dda0e292882deeab9e8bc33d

Contents?: true

Size: 471 Bytes

Versions: 90

Compression:

Stored size: 471 Bytes

Contents

require 'exercise_cases'

class LeapCase < OpenStruct
  def name
    'test_%s' % description.downcase.gsub(/[ -]/, '_')
  end

  def do
    "Year.leap?(#{input})"
  end

  def skip
    index.zero? ? '# skip' : 'skip'
  end

  def failure_message
    "Expected '#{expected}', #{input} is #{expected ? '' : 'not '}a leap year."
  end
end

LeapCases = proc do |data|
  JSON.parse(data)['cases'].map.with_index do |row, i|
    LeapCase.new(row.merge('index' => i))
  end
end

Version data entries

90 entries across 90 versions & 1 rubygems

Version Path
trackler-2.0.8.37 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.36 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.35 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.34 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.33 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.32 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.31 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.30 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.29 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.28 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.27 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.26 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.24 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.23 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.22 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.21 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.20 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.19 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.18 tracks/ruby/lib/leap_cases.rb
trackler-2.0.8.17 tracks/ruby/lib/leap_cases.rb