Module: MentionSystem::Mentioner
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/mention_system/mentioner.rb
Overview
Mentioner module
This module defines mentioner behavior in mention system
Instance Method Summary collapse
-
#is_mentioner? ⇒ Boolean
Specifies if self can mention Mentionee objects.
- #mention(mentionee) ⇒ Boolean
-
#mentionees_by(klass) ⇒ ActiveRecord::Relation
Retrieves a scope of Mention objects that are mentioned by self.
-
#mentions?(mentionee) ⇒ Boolean
Specifies if self mentions a Mentioner object.
- #toggle_mention(mentionee) ⇒ Boolean
- #unmention(mentionee) ⇒ Boolean
Instance Method Details
#is_mentioner? ⇒ Boolean
Specifies if self can mention MentionSystem::Mentionee objects
33 34 35 |
# File 'lib/mention_system/mentioner.rb', line 33 def is_mentioner? true end |
#mention(mentionee) ⇒ Boolean
Creates a MentionSystem::Mention relationship between self and a MentionSystem::Mentionee object
43 44 45 |
# File 'lib/mention_system/mentioner.rb', line 43 def mention(mentionee) Mention.mention(self, mentionee) end |
#mentionees_by(klass) ⇒ ActiveRecord::Relation
Retrieves a scope of MentionSystem::Mention objects that are mentioned by self
83 84 85 |
# 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) ⇒ Boolean
Specifies if self mentions a MentionSystem::Mentioner object
73 74 75 |
# File 'lib/mention_system/mentioner.rb', line 73 def mentions?(mentionee) Mention.mentions?(self, mentionee) end |
#toggle_mention(mentionee) ⇒ Boolean
Toggles a MentionSystem::Mention relationship between self and a MentionSystem::Mentionee object
63 64 65 |
# File 'lib/mention_system/mentioner.rb', line 63 def toggle_mention(mentionee) Mention.toggle_mention(self, mentionee) end |
#unmention(mentionee) ⇒ Boolean
Destroys a MentionSystem::Mention relationship between self and a MentionSystem::Mentionee object
53 54 55 |
# File 'lib/mention_system/mentioner.rb', line 53 def unmention(mentionee) Mention.unmention(self, mentionee) end |