Class: Songfile::ClassicSong
Instance Attribute Summary collapse
-
#initial_rank ⇒ Object
readonly
Returns the value of attribute initial_rank.
Attributes inherited from Song
Instance Method Summary collapse
-
#initialize(title, rank = 10000) ⇒ ClassicSong
constructor
A new instance of ClassicSong.
Methods inherited from Song
#describe, #status, #thumbs_down, #thumbs_up, #titleize, #to_s, #top_ten?
Constructor Details
#initialize(title, rank = 10000) ⇒ ClassicSong
Returns a new instance of ClassicSong.
5 6 7 8 9 10 11 |
# File 'lib/songfile/classic_song.rb', line 5 def initialize(title, rank=10000) @initial_rank = rank @title = titleize(title) @rank = (rank.abs()) / 2 puts "New song '#{@title}' (classic) with rank of #{@rank} was created." # puts "The classic song '#{@title}' jumps the chart with a halved rank !" end |
Instance Attribute Details
#initial_rank ⇒ Object (readonly)
Returns the value of attribute initial_rank.
4 5 6 |
# File 'lib/songfile/classic_song.rb', line 4 def initial_rank @initial_rank end |