Class: Notu::Track
- Inherits:
-
Object
- Object
- Notu::Track
- Defined in:
- lib/notu/track.rb
Instance Attribute Summary collapse
-
#artist ⇒ Object
readonly
Returns the value of attribute artist.
-
#plays_count ⇒ Object
readonly
Returns the value of attribute plays_count.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(attributes = {}) ⇒ Track
constructor
A new instance of Track.
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
#artist ⇒ Object
Returns the value of attribute artist.
5 6 7 |
# File 'lib/notu/track.rb', line 5 def artist @artist end |
#plays_count ⇒ Object
Returns the value of attribute plays_count.
5 6 7 |
# File 'lib/notu/track.rb', line 5 def plays_count @plays_count end |
#title ⇒ Object
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
18 19 20 |
# File 'lib/notu/track.rb', line 18 def eql?(other) super || self == other end |