Sha256: 88097c2d8ba3bb1f699447e7405838feff5ad63ef2cee347c884ab7e80ffea31

Contents?: true

Size: 505 Bytes

Versions: 3

Compression:

Stored size: 505 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)
      self.user.id  != api_id
    end
    
    def like
      self.likes.select { |like| like.unlikable_by?(api.profile.id) }.first
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
socialcastr-0.2.12 lib/socialcastr/comment.rb
socialcastr-0.2.11 lib/socialcastr/comment.rb
socialcastr-0.2.10 lib/socialcastr/comment.rb