Merge pull request #195 from nashby/singleton

use singleton_class since we drop ruby < 1.9.3 support
This commit is contained in:
Steve Klabnik 2012-05-13 08:59:36 -07:00
commit aa6bd67614
2 changed files with 2 additions and 6 deletions

View File

@ -10,11 +10,9 @@ module Draper::ActiveModelSupport
proxies.each do |method_name, dependency|
if base.model.kind_of?(dependency) || dependency.nil?
class << base
self
end.class_eval do
base.singleton_class.class_eval do
if !base.class.instance_methods.include?(method_name) || base.class.instance_method(method_name).owner === Draper::Base
send(:define_method, method_name) do |*args, &block|
define_method(method_name) do |*args, &block|
model.send(method_name, *args, &block)
end
end

View File

@ -11,8 +11,6 @@ module Draper
self.denied = DEFAULT_DENIED
self.allowed = DEFAULT_ALLOWED
# Initialize a new decorator instance by passing in
# an instance of the source class. Pass in an optional
# context inside the options hash is stored for later use.