class Frosting::BasePresenter

Public Class Methods

new(resource, context = nil) click to toggle source
Calls superclass method
# File lib/frosting/base_presenter.rb, line 19
def initialize(resource, context = nil)
  @context = context
  @wrapped = resource
  super(@wrapped)
end
presents_super(*arguments) click to toggle source
Calls superclass method
# File lib/frosting/base_presenter.rb, line 8
def self.presents_super(*arguments)
  options = arguments.last.is_a?(Hash) ? arguments.pop : {}
  present_method = options.delete(:collection) ? :present_collection : :present

  arguments.each do |method|
    define_method(method) do
      send(present_method, super(), options.merge(context: @context))
    end
  end
end

Private Instance Methods

_context() click to toggle source
# File lib/frosting/base_presenter.rb, line 27
def _context
  @context
end
Also aliased as: view_context, h
h()
Alias for: _context
view_context()
Alias for: _context