Class: BillboardHot100::Song
- Inherits:
-
Object
- Object
- BillboardHot100::Song
- Defined in:
- lib/billboard_hot_100/song.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#artist ⇒ Object
Returns the value of attribute artist.
-
#award ⇒ Object
Returns the value of attribute award.
-
#last_week ⇒ Object
Returns the value of attribute last_week.
-
#lyrics ⇒ Object
Returns the value of attribute lyrics.
-
#peak_position ⇒ Object
Returns the value of attribute peak_position.
-
#rank ⇒ Object
Returns the value of attribute rank.
-
#title ⇒ Object
Returns the value of attribute title.
-
#weeks_on_chart ⇒ Object
Returns the value of attribute weeks_on_chart.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(song_hash) ⇒ Song
constructor
A new instance of Song.
Constructor Details
#initialize(song_hash) ⇒ Song
Returns a new instance of Song.
13 14 15 16 17 18 |
# File 'lib/billboard_hot_100/song.rb', line 13 def initialize(song_hash) song_hash.each do |key, value| self.send(:"#{key}=", value) end @@all << self end |
Instance Attribute Details
#artist ⇒ Object
Returns the value of attribute artist.
3 4 5 |
# File 'lib/billboard_hot_100/song.rb', line 3 def artist @artist end |
#award ⇒ Object
Returns the value of attribute award.
3 4 5 |
# File 'lib/billboard_hot_100/song.rb', line 3 def award @award end |
#last_week ⇒ Object
Returns the value of attribute last_week.
3 4 5 |
# File 'lib/billboard_hot_100/song.rb', line 3 def last_week @last_week end |
#lyrics ⇒ Object
Returns the value of attribute lyrics.
3 4 5 |
# File 'lib/billboard_hot_100/song.rb', line 3 def lyrics @lyrics end |
#peak_position ⇒ Object
Returns the value of attribute peak_position.
3 4 5 |
# File 'lib/billboard_hot_100/song.rb', line 3 def peak_position @peak_position end |
#rank ⇒ Object
Returns the value of attribute rank.
3 4 5 |
# File 'lib/billboard_hot_100/song.rb', line 3 def rank @rank end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/billboard_hot_100/song.rb', line 3 def title @title end |
#weeks_on_chart ⇒ Object
Returns the value of attribute weeks_on_chart.
3 4 5 |
# File 'lib/billboard_hot_100/song.rb', line 3 def weeks_on_chart @weeks_on_chart end |
Class Method Details
.all ⇒ Object
20 21 22 |
# File 'lib/billboard_hot_100/song.rb', line 20 def self.all @@all end |
.create(songs) ⇒ Object
7 8 9 10 11 |
# File 'lib/billboard_hot_100/song.rb', line 7 def self.create(songs) songs.each do |song| self.new(song) end end |