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.1.0.16 tracks/ruby/exercises/space-age/.meta/solutions/space_age.rb
trackler-2.1.0.15 tracks/ruby/exercises/space-age/.meta/solutions/space_age.rb
trackler-2.1.0.14 tracks/ruby/exercises/space-age/.meta/solutions/space_age.rb
trackler-2.1.0.13 tracks/ruby/exercises/space-age/.meta/solutions/space_age.rb
trackler-2.1.0.12 tracks/ruby/exercises/space-age/.meta/solutions/space_age.rb
trackler-2.1.0.11 tracks/ruby/exercises/space-age/example.rb
trackler-2.1.0.10 tracks/ruby/exercises/space-age/example.rb
trackler-2.1.0.9 tracks/ruby/exercises/space-age/example.rb
trackler-2.1.0.8 tracks/ruby/exercises/space-age/example.rb
trackler-2.1.0.7 tracks/ruby/exercises/space-age/example.rb
trackler-2.1.0.6 tracks/ruby/exercises/space-age/example.rb
trackler-2.1.0.5 tracks/ruby/exercises/space-age/example.rb
trackler-2.1.0.4 tracks/ruby/exercises/space-age/example.rb
trackler-2.1.0.3 tracks/ruby/exercises/space-age/example.rb
trackler-2.1.0.2 tracks/ruby/exercises/space-age/example.rb
trackler-2.1.0.1 tracks/ruby/exercises/space-age/example.rb
trackler-2.1.0.0 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.55 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.54 tracks/ruby/exercises/space-age/example.rb
trackler-2.0.8.53 tracks/ruby/exercises/space-age/example.rb