Module: DecentPresenter::Exposable

Included in:
Base
Defined in:
lib/decent_presenter/exposable.rb

Defined Under Namespace

Classes: DoesNotImplementViewContextError

Instance Method Summary collapse

Instance Method Details

#present(presentable, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/decent_presenter/exposable.rb', line 6

def present(presentable, options = {})
  if respond_to? :view_context
    DecentPresenter::Exposure.new(
      view_context, DecentPresenter::Factory
    ).present(presentable, options)
  else
    raise DecentPresenter::Exposable::DoesNotImplementViewContextError.new(
      "Object must implement :view_context method to handle presentation"
    )
  end
end