Permalink
Browse files

Add array support

  • Loading branch information...
1 parent 9a80098 commit 4d5b4809f5f80bdc21f731f9431097e287288688 @barelyknown barelyknown committed Oct 9, 2012
Showing with 12 additions and 0 deletions.
  1. +1 −0 lib/draper.rb
  2. +7 −0 lib/draper/array_support.rb
  3. +4 −0 lib/draper/railtie.rb
View
1 lib/draper.rb
@@ -9,6 +9,7 @@
require 'draper/helper_support'
require 'draper/view_context'
require 'draper/decorated_enumerable_proxy'
+require 'draper/array_support'
require 'draper/railtie' if defined?(Rails)
# Test Support
View
7 lib/draper/array_support.rb
@@ -0,0 +1,7 @@
+module Draper::ArraySupport
+
+ def decorate
+ collect { |item| item.decorate if item.respond_to? :decorator_class }
+ end
+
+end
View
4 lib/draper/railtie.rb
@@ -39,6 +39,10 @@ class Railtie < Rails::Railtie
self.send(:include, Draper::ModelSupport)
end
end
+
+ initializer "draper.extend_array" do |app|
+ Array.send(:include, Draper::ArraySupport)
+ end
console do
require 'action_controller/test_case'

0 comments on commit 4d5b480

Please sign in to comment.