module ActiveResponse::Controller::Core

Private Instance Methods

active_response_block() { || ... } click to toggle source
# File lib/active_response/controller/core.rb, line 31
def active_response_block
  respond_to do |format|
    active_response_custom_responses(format)
    ActiveResponse::Responders::Base.available_formats.each do |symbol|
      format.send(symbol) do
        find_active_responder(format)
        yield
      end
    end
  end
end
active_response_custom_responses(_format) click to toggle source
# File lib/active_response/controller/core.rb, line 43
def active_response_custom_responses(_format); end
active_response_handle_failure(_resource = nil) click to toggle source
# File lib/active_response/controller/core.rb, line 58
def active_response_handle_failure(_resource = nil)
  respond_with_failure!
  if respond_to?("#{action_name}_failure_#{active_response_type}", true)
    return send("#{action_name}_failure_#{active_response_type}")
  end
  send("#{action_name}_failure")
end
active_response_handle_success(_resource = nil) click to toggle source
# File lib/active_response/controller/core.rb, line 66
def active_response_handle_success(_resource = nil)
  respond_with_success!
  if respond_to?("#{action_name}_success_#{active_response_type}", true)
    return send("#{action_name}_success_#{active_response_type}")
  end
  send("#{action_name}_success")
end
active_response_options() click to toggle source
# File lib/active_response/controller/core.rb, line 49
def active_response_options
  base = "#{action_name}_#{@active_response_resolution}_options"
  if respond_to?("#{base}_#{active_response_type}", true)
    send("#{base}_#{active_response_type}")
  else
    send(base)
  end
end
active_response_success?() click to toggle source
# File lib/active_response/controller/core.rb, line 74
def active_response_success?
  @active_response_resolution == :success
end
active_response_type() click to toggle source
# File lib/active_response/controller/core.rb, line 45
def active_response_type
  @active_responder.type
end
execute_action() click to toggle source
# File lib/active_response/controller/core.rb, line 78
def execute_action
  return active_response_handle_success unless respond_to?("#{action_name}_execute", true)
  send("#{action_name}_execute") ? active_response_handle_success : active_response_handle_failure
end
find_active_responder(format) click to toggle source
# File lib/active_response/controller/core.rb, line 83
def find_active_responder(format)
  format_symbol = format.format.symbol
  @active_responder = ActiveResponse.responder_for(format_symbol).new(self, format_symbol)
end
respond_with_failure!() click to toggle source
# File lib/active_response/controller/core.rb, line 88
def respond_with_failure!
  @active_response_resolution = :failure
end
respond_with_success!() click to toggle source
# File lib/active_response/controller/core.rb, line 92
def respond_with_success!
  @active_response_resolution = :success
end