Class: BestCity::City
- Inherits:
-
Object
- Object
- BestCity::City
- Defined in:
- lib/best_cities/city.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#median_annual_salary ⇒ Object
Returns the value of attribute median_annual_salary.
-
#overall_value ⇒ Object
Returns the value of attribute overall_value.
-
#population ⇒ Object
Returns the value of attribute population.
-
#quality_of_life ⇒ Object
Returns the value of attribute quality_of_life.
-
#rank_city ⇒ Object
Returns the value of attribute rank_city.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(rank_city = nil, population = nil, median_annual_salary = nil, quality_of_life = nil, overall_value = nil, description = nil) ⇒ City
constructor
A new instance of City.
Constructor Details
#initialize(rank_city = nil, population = nil, median_annual_salary = nil, quality_of_life = nil, overall_value = nil, description = nil) ⇒ City
Returns a new instance of City.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/best_cities/city.rb', line 7 def initialize(rank_city=nil, population=nil, median_annual_salary=nil, quality_of_life=nil, overall_value=nil,description=nil) @description = description @rank_city = rank_city @population=population @median_annual_salary=median_annual_salary @quality_of_life=quality_of_life @overall_value=overall_value @@all.unshift(self) end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/best_cities/city.rb', line 3 def description @description end |
#median_annual_salary ⇒ Object
Returns the value of attribute median_annual_salary.
3 4 5 |
# File 'lib/best_cities/city.rb', line 3 def median_annual_salary @median_annual_salary end |
#overall_value ⇒ Object
Returns the value of attribute overall_value.
3 4 5 |
# File 'lib/best_cities/city.rb', line 3 def overall_value @overall_value end |
#population ⇒ Object
Returns the value of attribute population.
3 4 5 |
# File 'lib/best_cities/city.rb', line 3 def population @population end |
#quality_of_life ⇒ Object
Returns the value of attribute quality_of_life.
3 4 5 |
# File 'lib/best_cities/city.rb', line 3 def quality_of_life @quality_of_life end |
#rank_city ⇒ Object
Returns the value of attribute rank_city.
3 4 5 |
# File 'lib/best_cities/city.rb', line 3 def rank_city @rank_city end |
Class Method Details
.all ⇒ Object
18 19 20 |
# File 'lib/best_cities/city.rb', line 18 def self.all @@all end |
.find(id) ⇒ Object
22 23 24 |
# File 'lib/best_cities/city.rb', line 22 def self.find(id) self.all[id-1] end |