Class: SWR3::NowPlaying::Song

Inherits:
Object
  • Object
show all
Defined in:
lib/swr3_now_playing/song.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(artist, title) ⇒ Song

Returns a new instance of Song.



7
8
9
10
# File 'lib/swr3_now_playing/song.rb', line 7

def initialize(artist, title)
  @artist = artist
  @title = title
end

Instance Attribute Details

#artistObject (readonly)

Returns the value of attribute artist.



5
6
7
# File 'lib/swr3_now_playing/song.rb', line 5

def artist
  @artist
end

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'lib/swr3_now_playing/song.rb', line 5

def title
  @title
end

Instance Method Details

#==(other) ⇒ Object



12
13
14
15
# File 'lib/swr3_now_playing/song.rb', line 12

def ==(other)
  return false if other.nil?
  self.artist == other.artist && self.title == other.title
end

#to_sObject



17
18
19
# File 'lib/swr3_now_playing/song.rb', line 17

def to_s
  "#{@artist}: #{@title}"
end