Module: ActivePresent::PresenterHelper

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_present/presenter_helper.rb

Instance Method Summary collapse

Instance Method Details

#present(object, klass = nil) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/active_present/presenter_helper.rb', line 9

def present(object, klass = nil)
  klass ||= "#{object.class}Presenter".constantize
  presenter = klass.new(object, view_context)

  return yield presenter if block_given?
  presenter
end