Sha256: 29a19591e3e5188f100477b3b3047a039dda2fed6aede998032c0b3e60fa9f35
Contents?: true
Size: 1.14 KB
Versions: 18
Compression:
Stored size: 1.14 KB
Contents
module Socialization module Stores module Mixins module Mention public 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 def after_mention(method) raise Socialization::ArgumentError unless method.is_a?(Symbol) || method.nil? @after_create_hook = method end def after_unmention(method) raise Socialization::ArgumentError unless method.is_a?(Symbol) || method.nil? @after_destroy_hook = method end protected def call_after_create_hooks(mentioner, mentionable) self.send(@after_create_hook, mentioner, mentionable) if @after_create_hook touch_dependents(mentioner, mentionable) end def call_after_destroy_hooks(mentioner, mentionable) self.send(@after_destroy_hook, mentioner, mentionable) if @after_destroy_hook touch_dependents(mentioner, mentionable) end end end end end
Version data entries
18 entries across 18 versions & 3 rubygems