Class: WWFinder::Continent
- Inherits:
-
Object
- Object
- WWFinder::Continent
- Defined in:
- lib/ww_finder/continent.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#countries ⇒ Object
readonly
Returns the value of attribute countries.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #find_country(input) ⇒ Object
-
#initialize(name) ⇒ Continent
constructor
A new instance of Continent.
Constructor Details
#initialize(name) ⇒ Continent
Returns a new instance of Continent.
7 8 9 10 11 |
# File 'lib/ww_finder/continent.rb', line 7 def initialize(name) @name = name @countries = [] save end |
Instance Attribute Details
#countries ⇒ Object (readonly)
Returns the value of attribute countries.
3 4 5 |
# File 'lib/ww_finder/continent.rb', line 3 def countries @countries end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/ww_finder/continent.rb', line 2 def name @name end |
Class Method Details
.all ⇒ Object
13 14 15 16 |
# File 'lib/ww_finder/continent.rb', line 13 def self.all WWFinder::Scraper.scrape_continents_and_countries if @@all.empty? @@all end |
.find(input) ⇒ Object
18 19 20 |
# File 'lib/ww_finder/continent.rb', line 18 def self.find(input) all[input] end |
Instance Method Details
#find_country(input) ⇒ Object
22 23 24 |
# File 'lib/ww_finder/continent.rb', line 22 def find_country(input) countries[input] end |