Module: MentionSystem::Mentionee

Extended by:
ActiveSupport::Concern
Defined in:
lib/mention_system/mentionee.rb

Overview

Mentionee module

This module defines mentionee behavior in mention system

Instance Method Summary collapse

Instance Method Details

#is_mentionee?Boolean

Specifies if self can be mentioned by MentionSystem::Mentioner objects

Returns:

  • (Boolean)


33
34
35
# File 'lib/mention_system/mentionee.rb', line 33

def is_mentionee?
  true
end

#mentioned_by?(mentioner) ⇒ Boolean

Specifies if self is mentioned by a MentionSystem::Mentioner object

Parameters:

Returns:

  • (Boolean)


43
44
45
# File 'lib/mention_system/mentionee.rb', line 43

def mentioned_by?(mentioner)
  Mention.mentions?(mentioner, self)
end

#mentioners_by(klass) ⇒ ActiveRecord::Relation

Retrieves a scope of MentionSystem::Mention objects that mentions self filtered MentionSystem::Mentioner type

Parameters:

  • klass (Class)
    • the Class to filter

Returns:

  • (ActiveRecord::Relation)


53
54
55
# File 'lib/mention_system/mentionee.rb', line 53

def mentioners_by(klass)
  Mention.scope_by_mentionee(self).scope_by_mentioner_type(klass)
end