youpy/ruby-lastfm

user.get_loved_tracks does not always return an array

Sleft opened this issue · 0 comments

It is possible to get three different return types from user.get_loved_tracks:

  • When a user has more than one loved track it returns an array.
  • When a user has only one loved track it returns a hash.
  • When a user has not got any loved tracks it returns nil.

This leads to ugly code. For example if one wants to use each on the result from user.get_loved_tracks one has to check before whether it is nil or a hash. This is similar to #46.