Sha256: 14d502b39179d77416faa5d58540a796288fc94af4f744bd9b274e8cbde16074
Contents?: true
Size: 559 Bytes
Versions: 11
Compression:
Stored size: 559 Bytes
Contents
module Mongoid module Publishable class Callback def initialize(*args, &block) if block_given? @method = block elsif args.length == 1 && args[0].kind_of?(Symbol) @method = args[0] else raise ArgumentError, "after_publish only allows a block or a symbol method reference as arguments" end end def process(object) if @method.respond_to?(:yield) @method.yield(object) else object.send(@method) end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems