Sha256: 6fd8d9ef79b56b66d07f949719c625a4852d78848433d7020e37613affdc640e

Contents?: true

Size: 552 Bytes

Versions: 1

Compression:

Stored size: 552 Bytes

Contents

module Socialcastr
  class Comment < Base
    def like!
      Socialcastr::Like.new({}, to_prefix_options).save
      refresh
      return self
    end

    def unlike!
      like.destroy
      refresh
      return self
    end

    def unlikable_by?(api_id)
      self.likes.map{|l| l.unlikable_by?(api_id)}.any?
    end
    
    def likable_by?(api_id)
      return false if self.user.id == api_id
      like_for(api_id).nil?
    end
    
    def like_for(api_id)
      self.likes.select { |like| like.unlikable_by?(api_id) }.first
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
socialcastr-0.2.13 lib/socialcastr/comment.rb