Class: Podcast
- Inherits:
-
Object
- Object
- Podcast
- Defined in:
- lib/podcastme/podcast.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#producer ⇒ Object
Returns the value of attribute producer.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title, producer, url, summary) ⇒ Podcast
constructor
A new instance of Podcast.
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
#producer ⇒ Object
Returns the value of attribute producer.
2 3 4 |
# File 'lib/podcastme/podcast.rb', line 2 def producer @producer end |
#summary ⇒ Object
Returns the value of attribute summary.
2 3 4 |
# File 'lib/podcastme/podcast.rb', line 2 def summary @summary end |
#title ⇒ Object
Returns the value of attribute title.
2 3 4 |
# File 'lib/podcastme/podcast.rb', line 2 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/podcastme/podcast.rb', line 2 def url @url end |
Class Method Details
.all ⇒ Object
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 |