Sha256: 04b3c40b5d2059d57781eefce84077febf4d1dd0f34b71b10386de3c9d4b0ce2

Contents?: true

Size: 415 Bytes

Versions: 6

Compression:

Stored size: 415 Bytes

Contents

class Planet
  include DataMapper::Resource

  property :name, String, :key => true
  property :aphelion, Float

  def category
    case self.name.downcase
    when "mercury", "venus", "earth", "mars" then "terrestrial"
    when "jupiter", "saturn", "uranus", "neptune" then "gas giants"
    when "pluto" then "dwarf planets"
    end
  end

  def has_known_form_of_life?
    self.name.downcase == "earth"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dm-serializer-0.9.4 spec/fixtures/planet.rb
dm-serializer-0.9.3 spec/fixtures/planet.rb
dm-serializer-0.9.2 spec/fixtures/planet.rb
dm-serializer-0.9.6 spec/fixtures/planet.rb
dm-serializer-0.9.5 spec/fixtures/planet.rb
dm-serializer-0.9.7 spec/fixtures/planet.rb