lib/keynote.rb
def present(view, *objects)
      if objects[0].is_a?(Symbol) || objects[0].is_a?(String)
        name = objects.shift
      else
        name = presenter_name_from_object(objects[0])
      end

      Cache.fetch(name, view, *objects) do
        presenter_from_name(name).new(view, *objects).tap do |presenter|
          yield presenter if block_given?
        end
      end
    end
# Create or retrieve a presenter wrapping zero or more objects.
# If a block is given, yield the presenter into it.
#
# The first parameter is a Rails view context, but you'll usually access
# this method through `Keynote::Helper#present`,
# `Keynote::Controller#present`, or `Keynote::Presenter#present`, all of
# which handle the view context parameter automatically.
#
# @see Keynote::Helper#present
# @see Keynote::Controller#present
# @see Keynote::Presenter#present
#
# @overload present(view, *objects)
#   Return a presenter wrapping the given objects. The type of the
#   presenter will be inferred from the type of the first object.
#   @example
#     present(view, MyModel.new)           # => #<MyModelPresenter:0x0001>
#   @param [ActionView::Base] view
#   @param [Array] objects
#   @return [Keynote::Presenter]
#
# @overload present(view, presenter_name, *objects)
#   Return a presenter wrapping the given objects. The type of the
#   presenter is specified in underscore form by the first parameter.
#   @example
#     present(view, :foo_bar, MyModel.new) # => #<FooBarPresenter:0x0002>
#   @param [ActionView::Base] view
#   @param [Symbol, String] presenter_name
#   @param [Array] objects
#   @return [Keynote::Presenter]
#
Create or retrieve a presenter wrapping zero or more objects.
If a block is given, yield the presenter into it.


Create or retrieve a presenter wrapping zero or more objects . If a block is given yield the presenter into it .
def present(view, *objects)
      if objects[0].is_a?(Symbol) || objects[0].is_a?(String)
        name = objects.shift
      else
        name = presenter_name_from_object(objects[0])
      end
      Cache.fetch(name, view, *objects) do
        presenter_from_name(name).new(view, *objects).tap do |presenter|
          yield presenter if block_given?
        end
      end
    end
def present ( view , * objects ) if objects [ 0 ] . is_a? ( Symbol ) || objects [ 0 ] . is_a? ( String ) name = objects . shift else name = presenter_name_from_object ( objects [ 0 ] ) end Cache . fetch ( name , view , * objects ) do presenter_from_name ( name ) . new ( view , * objects ) . tap do | presenter | yield presenter if block_given? end end end
Create or retrieve a presenter wrapping zero or more objects.
Create or retrieve a presenter wrapping zero or more objects .
view
objects
see
None
see
None
see
None
overload
present(view, *objects) Return a presenter wrapping the given objects. The type of the presenter will be inferred from the type of the first object. @example present(view, MyModel.new) # => # @param [ActionView::Base] view @param [Array] objects @return [Keynote::Presenter]
present ( view * objects ) Return a presenter wrapping the given objects . The type of the presenter will be inferred from the type of the first object . @example present ( view MyModel . new ) # = > # @param [ ActionView :: Base ] view @param [ Array ] objects @return [ Keynote :: Presenter ]
overload
present(view, presenter_name, *objects) Return a presenter wrapping the given objects. The type of the presenter is specified in underscore form by the first parameter. @example present(view, :foo_bar, MyModel.new) # => # @param [ActionView::Base] view @param [Symbol, String] presenter_name @param [Array] objects @return [Keynote::Presenter]
present ( view presenter_name * objects ) Return a presenter wrapping the given objects . The type of the presenter is specified in underscore form by the first parameter . @example present ( view : foo_bar MyModel . new ) # = > # @param [ ActionView :: Base ] view @param [ Symbol String ] presenter_name @param [ Array ] objects @return [ Keynote :: Presenter ]