Skip to content

Commit

Permalink
presentable is a collection if responds to :to_ary
Browse files Browse the repository at this point in the history
  • Loading branch information
Azdaroth committed Mar 29, 2015
1 parent ecf859b commit 1c7ca6e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/decent_presenter/exposure.rb
Expand Up @@ -2,7 +2,7 @@

module DecentPresenter
class Exposure

attr_reader :view_context, :presenter_factory
private :view_context, :presenter_factory

Expand Down Expand Up @@ -31,11 +31,11 @@ def present_model(presentable, options = {})
def present_collection(collection, options = {})
presented_collection = collection.map { |el| present_model(el, options) }
DecentPresenter::CollectionProxy.new(collection, presented_collection)
end
end

def presentable_is_a_collection?(presentable)
[:size, :to_a, :first].all? { |method| presentable.respond_to? method }
presentable.respond_to? :to_ary
end

end
end
end

0 comments on commit 1c7ca6e

Please sign in to comment.