Class: WorldTraveler::Highlights

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, continent, link) ⇒ Highlights

Returns a new instance of Highlights.



5
6
7
8
9
10
11
12
13
# File 'lib/world_traveler/highlights.rb', line 5

def initialize(name, continent, link)
  @name = name
  @continent = continent
  @link = link
  @info = []
#   # notify month about the event
  add_to_continent
  save
end

Instance Attribute Details

#continentObject

Returns the value of attribute continent.



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

def continent
  @continent
end

#indexObject

Returns the value of attribute index.



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

def index
  @index
end

#infoObject

Returns the value of attribute info.



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

def info
  @info
end

Returns the value of attribute link.



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

def link
  @link
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

Class Method Details

.allObject



15
16
17
# File 'lib/world_traveler/highlights.rb', line 15

def self.all 
  @@all 
end

Instance Method Details

#add_to_continentObject



19
20
21
# File 'lib/world_traveler/highlights.rb', line 19

def add_to_continent
  @continent.highlights << self unless @continent.highlights.include?(self)
end

#get_highlight_detailsObject



23
24
25
# File 'lib/world_traveler/highlights.rb', line 23

def get_highlight_details
  WorldTraveler::Scraper.scrape_info(self) if @info.empty?
end

#saveObject



27
28
29
# File 'lib/world_traveler/highlights.rb', line 27

def save
  @@all << self
end