module MentionSystem::Mentionee

Mentionee module

This module defines mentionee behavior in mention system

Public Instance Methods

is_mentionee?() click to toggle source

Specifies if self can be mentioned by {Mentioner} objects

@return [Boolean]

# File lib/mention_system/mentionee.rb, line 33
def is_mentionee?
  true
end
mentioned_by?(mentioner) click to toggle source

Specifies if self is mentioned by a {Mentioner} object

@param [Mentioner] mentioner - the {Mentioner} object to test against @return [Boolean]

# File lib/mention_system/mentionee.rb, line 43
def mentioned_by?(mentioner)
  Mention.mentions?(mentioner, self)
end
mentioners_by(klass) click to toggle source

Retrieves a scope of {Mention} objects that mentions self filtered {Mentioner} type

@param [Class] klass - the {Class} to filter @return [ActiveRecord::Relation]

# File lib/mention_system/mentionee.rb, line 53
def mentioners_by(klass)
  Mention.scope_by_mentionee(self).scope_by_mentioner_type(klass)
end