Class: Cyrax::Presenter

Inherits:
Wrapper show all
Defined in:
lib/cyrax/presenter.rb

Instance Attribute Summary

Attributes inherited from Wrapper

#accessor, #options, #resource

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Wrapper

#initialize

Constructor Details

This class inherits a constructor from Cyrax::Wrapper

Class Method Details

.present(resource, options = {}) ⇒ Object



12
13
14
# File 'lib/cyrax/presenter.rb', line 12

def present(resource, options = {})
  self.new(resource, options).present
end

Instance Method Details

#presentObject



2
3
4
5
6
7
8
9
# File 'lib/cyrax/presenter.rb', line 2

def present
  should_decorate = options[:decorate].nil? || options[:decorate]
  if options[:decorator] && should_decorate
    present_with_decoration(resource, options)
  else
    present_without_decoration(resource, options)
  end
end