Module: PresenterObject::Presentable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/presenter_object/presentable.rb
Overview
Include this concern in a model class to easily wrap the model in a presenter e.g:
class Document < ActiveRecord::Base
include PresenterObject::Presentable
end
Now turn any instance into a presenter-wrapped model e.g:
document = Document.find(params).presenterize
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- PresenterNotRegistered =
Class.new KeyError
Instance Method Summary collapse
Instance Method Details
#presenter_class ⇒ Object
27 28 29 |
# File 'lib/presenter_object/presentable.rb', line 27 def presenter_class self.class.presenter_class end |
#presenterize(view_context = nil) ⇒ Object
31 32 33 |
# File 'lib/presenter_object/presentable.rb', line 31 def presenterize(view_context = nil) presenter_class.new self, view_context end |