Class Spaceship
In: app/models/spaceship.rb
Parent: Object

Methods

Public Class methods

What name does a product have

[Source]

    # File app/models/spaceship.rb, line 12
12:   def self.get_name(product)
13:     case product.to_s
14:     when 'satellite'
15:       return 'Satellite'
16:     when '1'
17:       return 'Small Ship'
18:     when '2'
19:       return 'Medium Ship'
20:     when '3'
21:       return 'Big Ship'
22:     when 'money'
23:       return 'Money'
24:     end
25:   end

How much does a certain ship cost

[Source]

   # File app/models/spaceship.rb, line 4
4:   def self.get_price(strength)
5:     if strength.to_s.downcase == 'satellite'
6:       strength = 1
7:     end
8:         strength.to_i*100
9:   end

[Validate]