lib/artdeco.rb in artdeco-1.1.0 vs lib/artdeco.rb in artdeco-1.2.0
- old
+ new
@@ -6,9 +6,10 @@
module DecoratorMethods
def decorate model, *decorator_classes
return nil if model.nil?
+ return model.map{|m| decorate(m,*decorator_classes)} if model.respond_to?(:map)
decorator_classes = @decorator_classes || default_decorator_class(model) if decorator_classes.empty?
[decorator_classes].flatten.each{|dc|model.extend dc}
h = self.h
model.define_singleton_method(:h){h}
model.extend DecoratorMethods