Class: Story

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStory

Returns a new instance of Story.



6
7
8
# File 'lib/NBA_news/story.rb', line 6

def initialize
  @@all << self
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



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

def author
  @author
end

#contentObject

Returns the value of attribute content.



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

def content
  @content
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

Class Method Details

.allObject



10
11
12
# File 'lib/NBA_news/story.rb', line 10

def self.all
  @@all
end

.find_by_author(name) ⇒ Object



18
19
20
# File 'lib/NBA_news/story.rb', line 18

def self.find_by_author(name)
  self.all.find_all {|story| story.author == name} 
end

.list_authorsObject



14
15
16
# File 'lib/NBA_news/story.rb', line 14

def self.list_authors
  self.all.map {|story| story.author}
end