Sha256: d8fe1e0f800e128c8cb107226af55bcfd484cdd68011a093c471d981ea22cf9d

Contents?: true

Size: 789 Bytes

Versions: 3

Compression:

Stored size: 789 Bytes

Contents

module Emerson
  # Adds Emerson response handling & rendering.
  #
  # @example
  #   class ApplicationController < ActionController::Base
  #     include Emerson::Response
  #   end
  module Response
    class << self
      # Configures `base` with the follow feature flag awareness:
      #
      #   * if `Emerson.scope_enabled?`, will include `Emerson::Scope`
      #   * if `Emerson.responder_enabled?`, will set up `base.responder` to
      #     use `Emerson::Responder` with `:html` and `:json` mime types.
      def included(base)
        base.send(:include, Emerson::Scope) if Emerson.scope_enabled?

        if Emerson.responder_enabled?
          base.responder = Emerson::Responder
          base.class_eval('respond_to(:html, :json)')
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
emerson-0.1.0.pre.4 lib/emerson/response.rb
emerson-0.1.0.pre.3 lib/emerson/response.rb
emerson-0.1.0.pre.2 lib/emerson/response.rb