Class: Notu::Track

Inherits:
Object
  • Object
show all
Defined in:
lib/notu/track.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Track

Returns a new instance of Track.



7
8
9
10
11
12
# File 'lib/notu/track.rb', line 7

def initialize(attributes = {})
  attributes = attributes.stringify_keys
  self.artist = attributes['artist']
  self.plays_count = attributes['plays_count']
  self.title = attributes['title']
end

Instance Attribute Details

#artistObject

Returns the value of attribute artist.



5
6
7
# File 'lib/notu/track.rb', line 5

def artist
  @artist
end

#plays_countObject

Returns the value of attribute plays_count.



5
6
7
# File 'lib/notu/track.rb', line 5

def plays_count
  @plays_count
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/notu/track.rb', line 5

def title
  @title
end

Instance Method Details

#==(other) ⇒ Object



14
15
16
# File 'lib/notu/track.rb', line 14

def ==(other)
  other.is_a?(self.class) && artist == other.artist && title == other.title
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/notu/track.rb', line 18

def eql?(other)
  super || self == other
end