Sha256: cba8f8077efbe078362ff09fdfef035c088ffccb73e8975fd9ef443124c42f4f

Contents?: true

Size: 502 Bytes

Versions: 8

Compression:

Stored size: 502 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, &block)
      direct_descendants << base if base
      super
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
mongo_mapper-0.12.0 lib/mongo_mapper/plugins.rb
lookout-mongo_mapper-0.11.3 lib/mongo_mapper/plugins.rb
mongo_mapper-0.11.2 lib/mongo_mapper/plugins.rb
jamieorc-mongo_mapper-0.11.1.1 lib/mongo_mapper/plugins.rb
mongo_mapper-0.11.1 lib/mongo_mapper/plugins.rb
mongo_mapper-0.11.0 lib/mongo_mapper/plugins.rb
mongo_mapper-0.10.1 lib/mongo_mapper/plugins.rb
mongo_mapper-0.10.0 lib/mongo_mapper/plugins.rb