lib/rep.rb in rep-0.0.3 vs lib/rep.rb in rep-0.0.4

- old
+ new

@@ -35,10 +35,21 @@ def self.included(klass) klass.extend Forwardable klass.extend ClassMethods klass.instance_eval { + # Translate for ActiveSupport, the jerk + if method(:delegate).arity == -1 + class << self + def delegate(opts = {}) + methods, object_name = opts.to_a.first + args = methods.concat([:to => object_name]) + super(*args) + end + end + end + class << self unless defined?(delegate) def delegate(opts = {}) methods, object_name = opts.to_a.first args = [object_name, methods].flatten @@ -52,18 +63,9 @@ alias fields json_fields end if defined?(Hashie) include HashieSupport - end - end - - # Translate for ActiveSupport, the jerk - if method(:delegate).arity == -1 - def delegate(opts = {}) - methods, object_name = opts.to_a.first - args = methods.concat([:to => object_name]) - super(*args) end end } end