Class: Country
- Inherits:
-
Object
- Object
- Country
- Defined in:
- lib/country.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#iso ⇒ Object
Returns the value of attribute iso.
-
#long_term ⇒ Object
Returns the value of attribute long_term.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nuclear_e_share ⇒ Object
Returns the value of attribute nuclear_e_share.
-
#nuclear_electricity ⇒ Object
Returns the value of attribute nuclear_electricity.
-
#operational ⇒ Object
Returns the value of attribute operational.
-
#permanent_shutdown ⇒ Object
Returns the value of attribute permanent_shutdown.
-
#reactors ⇒ Object
Returns the value of attribute reactors.
-
#total_electricity ⇒ Object
Returns the value of attribute total_electricity.
-
#under_construction ⇒ Object
Returns the value of attribute under_construction.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(country_data) ⇒ Country
constructor
country_data is a hash that NuclearPowerReactors class will produce by scraping data.
Constructor Details
#initialize(country_data) ⇒ Country
country_data is a hash that NuclearPowerReactors class will produce by scraping data
8 9 10 11 12 13 14 |
# File 'lib/country.rb', line 8 def initialize(country_data) #country_data is a hash that NuclearPowerReactors class will produce by scraping data @reactors = [] #an array of all the reactors in the country country_data.each do |attribute, value| self.send(("#{attribute}="), value) end @@all << self end |
Instance Attribute Details
#iso ⇒ Object
Returns the value of attribute iso.
2 3 4 |
# File 'lib/country.rb', line 2 def iso @iso end |
#long_term ⇒ Object
Returns the value of attribute long_term.
2 3 4 |
# File 'lib/country.rb', line 2 def long_term @long_term end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/country.rb', line 2 def name @name end |
#nuclear_e_share ⇒ Object
Returns the value of attribute nuclear_e_share.
2 3 4 |
# File 'lib/country.rb', line 2 def nuclear_e_share @nuclear_e_share end |
#nuclear_electricity ⇒ Object
Returns the value of attribute nuclear_electricity.
2 3 4 |
# File 'lib/country.rb', line 2 def nuclear_electricity @nuclear_electricity end |
#operational ⇒ Object
Returns the value of attribute operational.
2 3 4 |
# File 'lib/country.rb', line 2 def operational @operational end |
#permanent_shutdown ⇒ Object
Returns the value of attribute permanent_shutdown.
2 3 4 |
# File 'lib/country.rb', line 2 def permanent_shutdown @permanent_shutdown end |
#reactors ⇒ Object
Returns the value of attribute reactors.
2 3 4 |
# File 'lib/country.rb', line 2 def reactors @reactors end |
#total_electricity ⇒ Object
Returns the value of attribute total_electricity.
2 3 4 |
# File 'lib/country.rb', line 2 def total_electricity @total_electricity end |
#under_construction ⇒ Object
Returns the value of attribute under_construction.
2 3 4 |
# File 'lib/country.rb', line 2 def under_construction @under_construction end |
Class Method Details
.all ⇒ Object
20 21 22 |
# File 'lib/country.rb', line 20 def self.all @@all end |