def setup(context, options, as, block)
        @options = options
        @block   = block

        @locals  = options[:locals] || {}
        @details = extract_details(options)

        partial = options[:partial]

        if String === partial
          @has_object = options.key?(:object)
          @object     = options[:object]
          @collection = collection_from_options
          @path       = partial
        else
          @has_object = true
          @object = partial
          @collection = collection_from_object || collection_from_options

          if @collection
            paths = @collection_data = @collection.map { |o| partial_path(o, context) }
            if paths.uniq.length == 1
              @path = paths.first
            else
              paths.map! { |path| retrieve_variable(path, as).unshift(path) }
              @path = nil
            end
          else
            @path = partial_path(@object, context)
          end
        end

        self
      end
def setup(context, options, as, block)
        @options = options
        @block   = block

        @locals  = options[:locals] || {}
        @details = extract_details(options)

        partial = options[:partial]

        if String === partial
          @has_object = options.key?(:object)
          @object     = options[:object]
          @collection = collection_from_options
          @path       = partial
        else
          @has_object = true
          @object = partial
          @collection = collection_from_object || collection_from_options

          if @collection
            paths = @collection_data = @collection.map { |o| partial_path(o, context) }
            if paths.uniq.length == 1
              @path = paths.first
            else
              paths.map! { |path| retrieve_variable(path, as).unshift(path) }
              @path = nil
            end
          else
            @path = partial_path(@object, context)
          end
        end

        self
      end
Sets up instance variables needed for rendering a partial. This method
 finds the options and details and extracts them. The method also contains
 logic that handles the type of object passed in as the partial.

 If +options[:partial]+ is a string, then the <tt>@path</tt> instance variable is
 set to that string. Otherwise, the +options[:partial]+ object must
 respond to +to_partial_path+ in order to setup the path.