class ActiveResponse::Responders::Base

Attributes

controller[RW]
format[RW]

Public Class Methods

new(controller, format) click to toggle source
# File lib/active_response/responders/base.rb, line 12
def initialize(controller, format)
  self.controller = controller
  self.format = format
end

Private Class Methods

available_formats() click to toggle source
# File lib/active_response/responders/base.rb, line 36
def available_formats
  return @available_formats if @available_formats.present?
  @available_formats =
    ActiveResponse.registered_responders.map(&:formats).flatten.sort { |format| format == :html ? 0 : 1 }
end
respond_to(*formats) click to toggle source
# File lib/active_response/responders/base.rb, line 28
def respond_to(*formats)
  self.formats = formats
end
type() click to toggle source
# File lib/active_response/responders/base.rb, line 32
def type
  @type ||= name.gsub('Responder', '').underscore.to_sym
end

Public Instance Methods

type() click to toggle source
# File lib/active_response/responders/base.rb, line 17
def type
  self.class.type
end

Private Instance Methods

content_type() click to toggle source
# File lib/active_response/responders/base.rb, line 23
def content_type
  Mime[format]&.to_s
end