Sha256: c4e2376dbcedf76c12037d73ad2f6da6f0b3764f59fb82f7eacb0b171c833800

Contents?: true

Size: 486 Bytes

Versions: 2

Compression:

Stored size: 486 Bytes

Contents

module Responders
  module DecorateResponder
    def respond
      @resource = decorate_resource(resource)
      super
    end

    def decorate_resource(res)
      return controller.decorate(res) if controller.respond_to? :decorate

      if res.respond_to? :decorate
        if controller.respond_to? :decoration_context
          return res.decorate context: controller.decoration_context
        else
          return res.decorate
        end
      end

      res
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decorate-responder-2.1.0 lib/responders/decorate_responder.rb
decorate-responder-2.0.0 lib/responders/decorate_responder.rb