Class: WorldTraveler::Highlights
- Inherits:
-
Object
- Object
- WorldTraveler::Highlights
- Defined in:
- lib/world_traveler/highlights.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#continent ⇒ Object
, :index.
-
#info ⇒ Object
, :index.
-
#link ⇒ Object
, :index.
-
#name ⇒ Object
, :index.
Class Method Summary collapse
Instance Method Summary collapse
- #add_to_continent ⇒ Object
- #get_highlight_details ⇒ Object
-
#initialize(name, continent, link) ⇒ Highlights
constructor
A new instance of Highlights.
- #save ⇒ Object
Constructor Details
#initialize(name, continent, link) ⇒ Highlights
Returns a new instance of Highlights.
5 6 7 8 9 10 11 12 |
# File 'lib/world_traveler/highlights.rb', line 5 def initialize(name, continent, link) @name = name @continent = continent @link = link @info = [] add_to_continent save end |
Instance Attribute Details
#continent ⇒ Object
, :index
2 3 4 |
# File 'lib/world_traveler/highlights.rb', line 2 def continent @continent end |
#info ⇒ Object
, :index
2 3 4 |
# File 'lib/world_traveler/highlights.rb', line 2 def info @info end |
#link ⇒ Object
, :index
2 3 4 |
# File 'lib/world_traveler/highlights.rb', line 2 def link @link end |
#name ⇒ Object
, :index
2 3 4 |
# File 'lib/world_traveler/highlights.rb', line 2 def name @name end |
Class Method Details
.all ⇒ Object
14 15 16 |
# File 'lib/world_traveler/highlights.rb', line 14 def self.all @@all end |
Instance Method Details
#add_to_continent ⇒ Object
18 19 20 |
# File 'lib/world_traveler/highlights.rb', line 18 def add_to_continent @continent.highlights << self unless @continent.highlights.include?(self) end |
#get_highlight_details ⇒ Object
22 23 24 |
# File 'lib/world_traveler/highlights.rb', line 22 def get_highlight_details WorldTraveler::Scraper.scrape_info(self) if @info.empty? end |
#save ⇒ Object
26 27 28 |
# File 'lib/world_traveler/highlights.rb', line 26 def save @@all << self end |