Module: Lokap::ActionView
- Defined in:
- lib/lokap/presenter/ext/action_view.rb
Defined Under Namespace
Classes: MissingTemplate
Instance Method Summary collapse
-
#present(entity, klass = nil, options = {}) ⇒ Lokap::Presenter
Helper method which allows access to your presenters.
Instance Method Details
#present(entity, klass = nil, options = {}) ⇒ Lokap::Presenter
Helper method which allows access to your presenters
19 20 21 22 23 24 25 |
# File 'lib/lokap/presenter/ext/action_view.rb', line 19 def present(entity, klass = nil, ={}) base_klass = klass ? klass.to_s.titleize.gsub(' ', '') : entity.class klass = "#{base_klass}Presenter".constantize presenter = klass.new(entity, self, ) yield presenter and return if block_given? presenter end |