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

Version Path
socialization-2.0.2 lib/socialization/stores/mixins/mention.rb
socialization-2.0.1 lib/socialization/stores/mixins/mention.rb
socialization-2.0.0 lib/socialization/stores/mixins/mention.rb
socialization-1.2.3 lib/socialization/stores/mixins/mention.rb
socialization-1.2.2 lib/socialization/stores/mixins/mention.rb
socialization-1.2.1 lib/socialization/stores/mixins/mention.rb
twrk-socialization-1.2.0 lib/socialization/stores/mixins/mention.rb
twrk-socialization-0.0.1 lib/socialization/stores/mixins/mention.rb
socialization-1.2.0 lib/socialization/stores/mixins/mention.rb
socialization-cassandra-0.0.7.pre.alpha lib/socialization/stores/mixins/mention.rb
socialization-cassandra-0.0.6.pre.alpha lib/socialization/stores/mixins/mention.rb
socialization-cassandra-0.0.5.pre.alpha lib/socialization/stores/mixins/mention.rb
socialization-cassandra-0.0.4.pre.alpha lib/socialization/stores/mixins/mention.rb
socialization-cassandra-0.0.3.pre.alpha lib/socialization/stores/mixins/mention.rb
socialization-cassandra-0.0.2.pre.alpha lib/socialization/stores/mixins/mention.rb
socialization-cassandra-0.0.1.pre.alpha lib/socialization/stores/mixins/mention.rb
socialization-1.1.0 lib/socialization/stores/mixins/mention.rb
socialization-1.0.0 lib/socialization/stores/mixins/mention.rb