Sha256: 0a2b6e881b40aa516e44c46b3b1217ce79cf1c7f5823ca548bb10fde2e81740e

Contents?: true

Size: 494 Bytes

Versions: 12

Compression:

Stored size: 494 Bytes

Contents

# encoding: UTF-8
module MongoMapper
  module Plugins
    include ActiveSupport::DescendantsTracker

    def plugins
      @plugins ||= []
    end

    def plugin(mod)
      raise ArgumentError,  "Plugins must extend ActiveSupport::Concern" unless ActiveSupport::Concern === mod
      include mod
      direct_descendants.each {|model| model.send(:include, mod) }
      plugins << mod
    end

    def included(base = nil)
      direct_descendants << base if base
      super
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mongo_mapper-0.15.5 lib/mongo_mapper/plugins.rb
mongo_mapper-0.15.4 lib/mongo_mapper/plugins.rb
mongo_mapper-0.15.3 lib/mongo_mapper/plugins.rb
mongo_mapper-0.15.2 lib/mongo_mapper/plugins.rb
mongo_mapper-0.15.1 lib/mongo_mapper/plugins.rb
mongo_mapper-0.15.0 lib/mongo_mapper/plugins.rb
mongo_mapper-0.14.0 lib/mongo_mapper/plugins.rb
mongo_mapper-0.14.0.rc1 lib/mongo_mapper/plugins.rb
mongo_mapper-0.13.1 lib/mongo_mapper/plugins.rb
mongo_mapper-0.13.0 lib/mongo_mapper/plugins.rb
mongo_mapper-0.13.0.beta2 lib/mongo_mapper/plugins.rb
mongo_mapper-0.13.0.beta1 lib/mongo_mapper/plugins.rb