Module: Recommendable::Ratable::Dislikable

Defined in:
lib/recommendable/ratable/dislikable.rb

Instance Method Summary collapse

Instance Method Details

#disliked_byArray

Fetch a list of users that have disliked this item.

Returns:

  • (Array)

    a list of users that have disliked this item



7
8
9
# File 'lib/recommendable/ratable/dislikable.rb', line 7

def disliked_by
  Recommendable.query(Recommendable.config.user_class, disliked_by_ids)
end

#disliked_by_countFixnum

Get the number of users that have disliked this item

Returns:

  • (Fixnum)

    the number of users that have disliked this item



14
15
16
# File 'lib/recommendable/ratable/dislikable.rb', line 14

def disliked_by_count
  Recommendable.redis.scard(Recommendable::Helpers::RedisKeyMapper.disliked_by_set_for(self.class, id))
end

#disliked_by_idsArray

Get the IDs of users that have disliked this item.

Returns:

  • (Array)

    the IDs of users that have disliked this item



21
22
23
# File 'lib/recommendable/ratable/dislikable.rb', line 21

def disliked_by_ids
  Recommendable.redis.smembers(Recommendable::Helpers::RedisKeyMapper.disliked_by_set_for(self.class, id))
end