Class: Country

Inherits:
Object
  • Object
show all
Defined in:
lib/country.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#isoObject

Returns the value of attribute iso.



2
3
4
# File 'lib/country.rb', line 2

def iso
  @iso
end

#long_termObject

Returns the value of attribute long_term.



2
3
4
# File 'lib/country.rb', line 2

def long_term
  @long_term
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/country.rb', line 2

def name
  @name
end

#nuclear_e_shareObject

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_electricityObject

Returns the value of attribute nuclear_electricity.



2
3
4
# File 'lib/country.rb', line 2

def nuclear_electricity
  @nuclear_electricity
end

#operationalObject

Returns the value of attribute operational.



2
3
4
# File 'lib/country.rb', line 2

def operational
  @operational
end

#permanent_shutdownObject

Returns the value of attribute permanent_shutdown.



2
3
4
# File 'lib/country.rb', line 2

def permanent_shutdown
  @permanent_shutdown
end

#reactorsObject

Returns the value of attribute reactors.



2
3
4
# File 'lib/country.rb', line 2

def reactors
  @reactors
end

#total_electricityObject

Returns the value of attribute total_electricity.



2
3
4
# File 'lib/country.rb', line 2

def total_electricity
  @total_electricity
end

#under_constructionObject

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

.allObject



20
21
22
# File 'lib/country.rb', line 20

def self.all
  @@all
end