module MentionSystem::Mentioner

Mentioner module

This module defines mentioner behavior in mention system

Public Instance Methods

is_mentioner?() click to toggle source

Specifies if self can mention {Mentionee} objects

@return [Boolean]

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

Creates a {Mention} relationship between self and a {Mentionee} object

@param [Mentionee] mentionee - the mentionee of the {Mention} relationship @return [Boolean]

# File lib/mention_system/mentioner.rb, line 43
def mention(mentionee)
  Mention.mention(self, mentionee)
end
mentionees_by(klass) click to toggle source

Retrieves a scope of {Mention} objects that are mentioned by self

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

# File lib/mention_system/mentioner.rb, line 83
def mentionees_by(klass)
  Mention.scope_by_mentioner(self).scope_by_mentionee_type(klass)
end
mentions?(mentionee) click to toggle source

Specifies if self mentions a {Mentioner} object

@param [Mentionee] mentionee - the {Mentionee} object to test against @return [Boolean]

# File lib/mention_system/mentioner.rb, line 73
def mentions?(mentionee)
  Mention.mentions?(self, mentionee)
end
toggle_mention(mentionee) click to toggle source

Toggles a {Mention} relationship between self and a {Mentionee} object

@param [Mentionee] mentionee - the mentionee of the {Mention} relationship @return [Boolean]

# File lib/mention_system/mentioner.rb, line 63
def toggle_mention(mentionee)
  Mention.toggle_mention(self, mentionee)
end
unmention(mentionee) click to toggle source

Destroys a {Mention} relationship between self and a {Mentionee} object

@param [Mentionee] mentionee - the mentionee of the {Mention} relationship @return [Boolean]

# File lib/mention_system/mentioner.rb, line 53
def unmention(mentionee)
  Mention.unmention(self, mentionee)
end