Class: Podcast

Inherits:
Object
  • Object
show all
Defined in:
lib/podcastme/podcast.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, producer, url, summary) ⇒ Podcast

Returns a new instance of Podcast.



12
13
14
15
16
17
18
19
20
# File 'lib/podcastme/podcast.rb', line 12

def initialize(title, producer, url, summary)
  #setting properties
  @title = title
  @producer = producer
  @url = url
  @summary = summary
  #all instances of Podcast will be stored in a class variable.
  @@all << self
end

Instance Attribute Details

#producerObject

Returns the value of attribute producer.



2
3
4
# File 'lib/podcastme/podcast.rb', line 2

def producer
  @producer
end

#summaryObject

Returns the value of attribute summary.



2
3
4
# File 'lib/podcastme/podcast.rb', line 2

def summary
  @summary
end

#titleObject

Returns the value of attribute title.



2
3
4
# File 'lib/podcastme/podcast.rb', line 2

def title
  @title
end

#urlObject

Returns the value of attribute url.



2
3
4
# File 'lib/podcastme/podcast.rb', line 2

def url
  @url
end

Class Method Details

.allObject



22
23
24
25
# File 'lib/podcastme/podcast.rb', line 22

def self.all
  #all Podcasts will be called in the @@all class variable.
  @@all
end

.find(index) ⇒ Object



6
7
8
9
10
# File 'lib/podcastme/podcast.rb', line 6

def self.find(index)
  #find by index number and convert from string to integer. - 1 bc count starts at 0.
  #consider putting this method into a findable Module.
  @@all[index.to_i-1]
end