module Socialization::Stores::Mixins::Mention

Public Instance Methods

after_mention(method) click to toggle source
# File lib/socialization/stores/mixins/mention.rb, line 16
def after_mention(method)
  raise Socialization::ArgumentError unless method.is_a?(Symbol) || method.nil?
  @after_create_hook = method
end
after_unmention(method) click to toggle source
# File lib/socialization/stores/mixins/mention.rb, line 21
def after_unmention(method)
  raise Socialization::ArgumentError unless method.is_a?(Symbol) || method.nil?
  @after_destroy_hook = method
end
touch(what = nil) click to toggle source
# File lib/socialization/stores/mixins/mention.rb, line 7
def touch(what = nil)
  if what.nil?
    @touch || false
  else
    raise Socialization::ArgumentError unless [:all, :mentioner, :mentionable, false, nil].include?(what)
    @touch = what
  end
end

Protected Instance Methods

call_after_create_hooks(mentioner, mentionable) click to toggle source
# File lib/socialization/stores/mixins/mention.rb, line 27
def call_after_create_hooks(mentioner, mentionable)
  self.send(@after_create_hook, mentioner, mentionable) if @after_create_hook
  touch_dependents(mentioner, mentionable)
end
call_after_destroy_hooks(mentioner, mentionable) click to toggle source
# File lib/socialization/stores/mixins/mention.rb, line 32
def call_after_destroy_hooks(mentioner, mentionable)
  self.send(@after_destroy_hook, mentioner, mentionable) if @after_destroy_hook
  touch_dependents(mentioner, mentionable)
end