Sha256: 4565076d03be295cf66e1daf3bdf46d6409d7e538ee73efa41a78bdf4130f2c0

Contents?: true

Size: 439 Bytes

Versions: 172

Compression:

Stored size: 439 Bytes

Contents

class SpaceAge
  attr_reader :seconds

  def initialize(seconds)
    @seconds = seconds
  end

  {
    mercury: 7_600_530.24,
    venus: 19_413_907.2,
    earth: 31_558_149.76,
    mars: 59_354_294.4,
    jupiter: 374_335_776.0,
    saturn: 929_596_608.0,
    uranus: 2_661_041_808.0,
    neptune: 5_200_418_592.0
  }.each do |planet, orbital_period|

    define_method("on_#{planet}") do
      seconds / orbital_period
    end

  end
end

Version data entries

172 entries across 172 versions & 1 rubygems

Version Path
trackler-2.0.8.52 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.51 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.50 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.49 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.48 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.47 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.46 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.45 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.44 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.43 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.42 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.41 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.40 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.39 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.38 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.37 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.36 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.35 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.34 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.33 tracks/ruby/exercises/space-age/example.rb