Skip to content

Commit

Permalink
Made plugins 1.9 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
SaschaK84 committed Jan 30, 2011
1 parent d2e8114 commit 32f534c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/mongo_mapper/plugins.rb
Expand Up @@ -6,9 +6,16 @@ def plugins
end

def plugin(mod)
extend mod::ClassMethods if mod.const_defined?(:ClassMethods)
include mod::InstanceMethods if mod.const_defined?(:InstanceMethods)
mod.configure(self) if mod.respond_to?(:configure)
if RUBY_VERSION < "1.9" # updated for ruby 1.9 support
extend mod::ClassMethods if mod.const_defined?(:ClassMethods)
include mod::InstanceMethods if mod.const_defined?(:InstanceMethods)
mod.configure(self) if mod.respond_to?(:configure)
else
extend mod::ClassMethods if mod.const_defined?(:ClassMethods, false)
include mod::InstanceMethods if mod.const_defined?(:InstanceMethods, false)
mod.configure(self) if mod.respond_to?(:configure)
end

plugins << mod
end
end
Expand Down

0 comments on commit 32f534c

Please sign in to comment.