Sha256: 1512af48dc87d799731c288957ce180e7cd0e83857b5019d4ee824aa290b2d73

Contents?: true

Size: 548 Bytes

Versions: 9

Compression:

Stored size: 548 Bytes

Contents

module Rack::App::InstanceMethods::Core

  attr_writer :request, :response

  def params
    request.env[::Rack::App::Constants::ENV::PARSED_PARAMS] ||= Rack::App::Params.new(request.env).to_hash
  end

  def validated_params
    request.env[::Rack::App::Constants::ENV::VALIDATED_PARAMS]
  end

  def request
    @request || raise("request object is not set for #{self.class}")
  end

  def response
    @response || raise("response object is not set for #{self.class}")
  end

  def finish_response
    throw(:rack_response, response)
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rack-app-5.5.1 lib/rack/app/instance_methods/core.rb
rack-app-5.4.0 lib/rack/app/instance_methods/core.rb
rack-app-5.3.2 lib/rack/app/instance_methods/core.rb
rack-app-5.3.1 lib/rack/app/instance_methods/core.rb
rack-app-5.3.0 lib/rack/app/instance_methods/core.rb
rack-app-5.2.0 lib/rack/app/instance_methods/core.rb
rack-app-5.1.0 lib/rack/app/instance_methods/core.rb
rack-app-5.0.0 lib/rack/app/instance_methods/core.rb
rack-app-5.0.0.rc2 lib/rack/app/instance_methods/core.rb