Class: ArchPresenter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/arch_presenter/base.rb

Class Method Summary collapse

Class Method Details

.present(target_object) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/arch_presenter/base.rb', line 3

def self.present(target_object)
  presenter_class_name = "#{target_object.class}Presenter"
  class_constant = presenter_class_name.constantize
  class_constant.new(target_object)
rescue NameError
  target_object
end