module MentionSystem::Mentioner
Mentioner
module
This module defines mentioner behavior in mention system
Public Instance Methods
Specifies if self can mention {Mentionee} objects
@return [Boolean]
# File lib/mention_system/mentioner.rb, line 33 def is_mentioner? true end
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
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
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
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
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