Class: Songfile::ClassicSong

Inherits:
Song
  • Object
show all
Defined in:
lib/songfile/classic_song.rb

Instance Attribute Summary collapse

Attributes inherited from Song

#rank, #title

Instance Method Summary collapse

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_rankObject (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