Class: ThisDayInHistory::Events

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEvents

Returns a new instance of Events.



6
7
8
# File 'lib/this_day_in_history/events.rb', line 6

def initialize
	@@all << self    
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



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

def category
  @category
end

#full_storyObject

Returns the value of attribute full_story.



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

def full_story
  @full_story
end

Returns the value of attribute link.



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

def link
  @link
end

#storyObject

Returns the value of attribute story.



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

def story
  @story
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

#yearObject

Returns the value of attribute year.



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

def year
  @year
end

Class Method Details

.allObject



10
11
12
# File 'lib/this_day_in_history/events.rb', line 10

def self.all
  @@all
end

.list_by_titleObject



18
19
20
# File 'lib/this_day_in_history/events.rb', line 18

def self.list_by_title
	@@all.each.with_index(1){|event, i| puts "#{i}. #{event.title} "}
end

.reset_allObject



14
15
16
# File 'lib/this_day_in_history/events.rb', line 14

def self.reset_all
  @@all.clear
end